Return IServiceCollection from AddSession extension methods

This commit is contained in:
jacalvar 2016-03-28 15:46:40 -07:00
parent a6382fe6af
commit 14473b5458
1 changed files with 7 additions and 2 deletions

View File

@ -16,7 +16,8 @@ namespace Microsoft.Extensions.DependencyInjection
/// Adds services required for application session state.
/// </summary>
/// <param name="services">The <see cref="IServiceCollection"/> to add the services to.</param>
public static void AddSession(this IServiceCollection services)
/// <returns>The <see cref="IServiceCollection"/> so that additional calls can be chained.</returns>
public static IServiceCollection AddSession(this IServiceCollection services)
{
if (services == null)
{
@ -24,6 +25,7 @@ namespace Microsoft.Extensions.DependencyInjection
}
services.AddTransient<ISessionStore, DistributedSessionStore>();
return services;
}
/// <summary>
@ -31,7 +33,8 @@ namespace Microsoft.Extensions.DependencyInjection
/// </summary>
/// <param name="services">The <see cref="IServiceCollection"/> to add the services to.</param>
/// <param name="configure">The session options to configure the middleware with.</param>
public static void AddSession(this IServiceCollection services, Action<SessionOptions> configure)
/// <returns>The <see cref="IServiceCollection"/> so that additional calls can be chained.</returns>
public static IServiceCollection AddSession(this IServiceCollection services, Action<SessionOptions> configure)
{
if (services == null)
{
@ -45,6 +48,8 @@ namespace Microsoft.Extensions.DependencyInjection
services.Configure(configure);
services.AddSession();
return services;
}
}
}