Minor fix to service collection extensions
This commit is contained in:
parent
342fe0b38b
commit
46f6fa85d5
|
|
@ -28,3 +28,4 @@ nuget.exe
|
||||||
project.lock.json
|
project.lock.json
|
||||||
.build/
|
.build/
|
||||||
.testPublish/
|
.testPublish/
|
||||||
|
launchSettings.json
|
||||||
|
|
@ -16,16 +16,14 @@ namespace Microsoft.Extensions.DependencyInjection
|
||||||
/// Adds services required for application session state.
|
/// Adds services required for application session state.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="services">The <see cref="IServiceCollection"/> to add the services to.</param>
|
/// <param name="services">The <see cref="IServiceCollection"/> to add the services to.</param>
|
||||||
/// <returns>The <see cref="IServiceCollection"/>.</returns>
|
public static void AddSession(this IServiceCollection services)
|
||||||
public static IServiceCollection AddSession(this IServiceCollection services)
|
|
||||||
{
|
{
|
||||||
if (services == null)
|
if (services == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(services));
|
throw new ArgumentNullException(nameof(services));
|
||||||
}
|
}
|
||||||
|
|
||||||
services.AddTransient<ISessionStore, DistributedSessionStore>();
|
services.AddTransient<ISessionStore, DistributedSessionStore>();
|
||||||
return services;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -33,16 +31,20 @@ namespace Microsoft.Extensions.DependencyInjection
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="services">The <see cref="IServiceCollection"/> to add the services to.</param>
|
/// <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>
|
/// <param name="configure">The session options to configure the middleware with.</param>
|
||||||
/// <returns>The <see cref="IServiceCollection"/>.</returns>
|
public static void AddSession(this IServiceCollection services, Action<SessionOptions> configure)
|
||||||
public static IServiceCollection AddSession(this IServiceCollection services, Action<SessionOptions> configure)
|
|
||||||
{
|
{
|
||||||
if (services == null)
|
if (services == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(services));
|
throw new ArgumentNullException(nameof(services));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (configure == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(configure));
|
||||||
|
}
|
||||||
|
|
||||||
services.Configure(configure);
|
services.Configure(configure);
|
||||||
return services.AddSession();
|
services.AddSession();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue