diff --git a/samples/SessionSample/Startup.cs b/samples/SessionSample/Startup.cs
index 79d0d54eda..2a7bbfdc1e 100644
--- a/samples/SessionSample/Startup.cs
+++ b/samples/SessionSample/Startup.cs
@@ -36,9 +36,7 @@ namespace SessionSample
// Adds a default in-memory implementation of IDistributedCache
services.AddCaching();
- services.AddSession();
-
- services.ConfigureSession(o =>
+ services.AddSession(o =>
{
o.IdleTimeout = TimeSpan.FromSeconds(10);
});
diff --git a/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs b/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs
index 04f73dbd41..af253aaaac 100644
--- a/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs
+++ b/src/Microsoft.AspNet.Session/SessionServiceCollectionExtensions.cs
@@ -25,15 +25,15 @@ namespace Microsoft.Framework.DependencyInjection
}
///
- /// Configures the session.
+ /// Adds services required for application session state.
///
- /// The to configure the services.
+ /// The to add the services to.
/// The session options to configure the middleware with.
- public static void ConfigureSession(
- [NotNull] this IServiceCollection services,
- [NotNull] Action configure)
+ /// The .
+ public static IServiceCollection AddSession([NotNull] this IServiceCollection services, Action configure)
{
services.Configure(configure);
+ return services.AddSession();
}
}
}
\ No newline at end of file
diff --git a/test/Microsoft.AspNet.Session.Tests/SessionTests.cs b/test/Microsoft.AspNet.Session.Tests/SessionTests.cs
index 1b2550e0e3..af91a911ca 100644
--- a/test/Microsoft.AspNet.Session.Tests/SessionTests.cs
+++ b/test/Microsoft.AspNet.Session.Tests/SessionTests.cs
@@ -275,8 +275,7 @@ namespace Microsoft.AspNet.Session
{
services.AddInstance(typeof(ILoggerFactory), loggerFactory);
services.AddCaching();
- services.AddSession();
- services.ConfigureSession(o => o.IdleTimeout = TimeSpan.FromMilliseconds(30));
+ services.AddSession(o => o.IdleTimeout = TimeSpan.FromMilliseconds(30));
}))
{
var client = server.CreateClient();
@@ -328,8 +327,7 @@ namespace Microsoft.AspNet.Session
{
services.AddInstance(typeof(ILoggerFactory), new NullLoggerFactory());
services.AddCaching();
- services.AddSession();
- services.ConfigureSession(o => o.IdleTimeout = TimeSpan.FromMinutes(20));
+ services.AddSession(o => o.IdleTimeout = TimeSpan.FromMinutes(20));
services.Configure(o => o.Clock = clock);
}))
{