/// <summary> /// Constructs a new <see cref="SessionMiddleware"/> instance. /// </summary> /// <param name="next">The next middleware in the chain.</param> /// <param name="options">The middleware specific options.</param> public SessionMiddleware(OwinMiddleware next, SessionMiddlewareOptions options) : base(next) { if (options == null) { throw new ArgumentNullException(nameof(options)); } _options = options; }
/// <summary> /// Use the session middleware. /// </summary> /// <param name="app">The <see cref="IAppBuilder"/> instance.</param> /// <param name="options">The optional session middleware options.</param> /// <returns>The <see cref="IAppBuilder"/> instance for method chaining.</returns> public static IAppBuilder UseSessionMiddleware(this IAppBuilder app, SessionMiddlewareOptions options = null) => app.Use <SessionMiddleware>(options ?? new SessionMiddlewareOptions());