ConfigureDP => AddDP

This commit is contained in:
Hao Kung 2015-11-17 13:46:52 -08:00
parent 5c94e8923a
commit 0b808ca75a
2 changed files with 5 additions and 6 deletions

View File

@ -41,9 +41,8 @@ namespace Microsoft.AspNet.DataProtection
} }
// build the service collection // build the service collection
ServiceCollection serviceCollection = new ServiceCollection(); var serviceCollection = new ServiceCollection();
serviceCollection.AddDataProtection(); serviceCollection.AddDataProtection(configurationObject =>
serviceCollection.ConfigureDataProtection(configurationObject =>
{ {
configurationObject.PersistKeysToFileSystem(keyDirectory); configurationObject.PersistKeysToFileSystem(keyDirectory);
configure?.Invoke(configurationObject); configure?.Invoke(configurationObject);

View File

@ -30,13 +30,13 @@ namespace Microsoft.Extensions.DependencyInjection
} }
/// <summary> /// <summary>
/// Configures the behavior of the Data Protection system. /// Adds default Data Protection services to an <see cref="IServiceCollection"/> and configures the behavior of the Data Protection system.
/// </summary> /// </summary>
/// <param name="services">A service collection to which Data Protection has already been added.</param> /// <param name="services">A service collection to which Data Protection has already been added.</param>
/// <param name="configure">A callback which takes a <see cref="DataProtectionConfiguration"/> parameter. /// <param name="configure">A callback which takes a <see cref="DataProtectionConfiguration"/> parameter.
/// This callback will be responsible for configuring the system.</param> /// This callback will be responsible for configuring the system.</param>
/// <returns>The <paramref name="services"/> instance.</returns> /// <returns>The <paramref name="services"/> instance.</returns>
public static IServiceCollection ConfigureDataProtection(this IServiceCollection services, Action<DataProtectionConfiguration> configure) public static IServiceCollection AddDataProtection(this IServiceCollection services, Action<DataProtectionConfiguration> configure)
{ {
if (services == null) if (services == null)
{ {
@ -49,7 +49,7 @@ namespace Microsoft.Extensions.DependencyInjection
} }
configure(new DataProtectionConfiguration(services)); configure(new DataProtectionConfiguration(services));
return services; return services.AddDataProtection();
} }
} }
} }