// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNet.Session;
using Microsoft.Framework.Internal;
namespace Microsoft.Framework.DependencyInjection
{
///
/// Extension methods for adding session services to the DI container.
///
public static class SessionServiceCollectionExtensions
{
///
/// Adds services required for application session state.
///
/// The to add the services to.
/// The .
public static IServiceCollection AddSession([NotNull] this IServiceCollection services)
{
services.AddOptions();
services.AddTransient();
return services;
}
///
/// Adds services required for application session state.
///
/// The to add the services to.
/// The session options to configure the middleware with.
/// The .
public static IServiceCollection AddSession([NotNull] this IServiceCollection services, Action configure)
{
services.Configure(configure);
return services.AddSession();
}
}
}