using System; using EmbedIO.Sessions; namespace EmbedIO { partial class WebServerExtensions { /// /// Sets the session manager on an . /// /// The type of the web server. /// The on which this method is called. /// The session manager. /// with the session manager set. /// is . /// The web server has already been started. public static TWebServer WithSessionManager(this TWebServer @this, ISessionManager sessionManager) where TWebServer : IWebServer { @this.SessionManager = sessionManager; return @this; } /// /// Creates a with all properties set to their default values /// and sets it as session manager on an . /// /// The type of the web server. /// The on which this method is called. /// A callback used to configure the session manager. /// with the session manager set. /// is . /// The web server has already been started. public static TWebServer WithLocalSessionManager(this TWebServer @this, Action? configure = null) where TWebServer : IWebServer { var sessionManager = new LocalSessionManager(); configure?.Invoke(sessionManager); @this.SessionManager = sessionManager; return @this; } } }