From 46f6fa85d5c7366ee3a383cbe92c10146127f916 Mon Sep 17 00:00:00 2001 From: Kiran Challa Date: Wed, 17 Feb 2016 09:11:19 -0800 Subject: [PATCH] Minor fix to service collection extensions --- .gitignore | 1 + .../SessionServiceCollectionExtensions.cs | 16 +++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) 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