diff --git a/.gitignore b/.gitignore index 10053022ad..f76d5c553d 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,4 @@ nuget.exe project.lock.json .build/ .testPublish/ +launchSettings.json \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Session/SessionServiceCollectionExtensions.cs b/src/Microsoft.AspNetCore.Session/SessionServiceCollectionExtensions.cs index 8f0d184d58..af5c9c4344 100644 --- a/src/Microsoft.AspNetCore.Session/SessionServiceCollectionExtensions.cs +++ b/src/Microsoft.AspNetCore.Session/SessionServiceCollectionExtensions.cs @@ -16,16 +16,14 @@ namespace Microsoft.Extensions.DependencyInjection /// Adds services required for application session state. /// /// The to add the services to. - /// The . - public static IServiceCollection AddSession(this IServiceCollection services) + public static void AddSession(this IServiceCollection services) { if (services == null) { throw new ArgumentNullException(nameof(services)); } - + services.AddTransient(); - return services; } /// @@ -33,16 +31,20 @@ namespace Microsoft.Extensions.DependencyInjection /// /// The to add the services to. /// The session options to configure the middleware with. - /// The . - public static IServiceCollection AddSession(this IServiceCollection services, Action configure) + public static void AddSession(this IServiceCollection services, Action configure) { if (services == null) { throw new ArgumentNullException(nameof(services)); } + if (configure == null) + { + throw new ArgumentNullException(nameof(configure)); + } + services.Configure(configure); - return services.AddSession(); + services.AddSession(); } } } \ No newline at end of file