diff --git a/src/Microsoft.AspNet.DataProtection.Extensions/DataProtectionProvider.cs b/src/Microsoft.AspNet.DataProtection.Extensions/DataProtectionProvider.cs
index fe8afe6db6..43764a0274 100644
--- a/src/Microsoft.AspNet.DataProtection.Extensions/DataProtectionProvider.cs
+++ b/src/Microsoft.AspNet.DataProtection.Extensions/DataProtectionProvider.cs
@@ -41,9 +41,8 @@ namespace Microsoft.AspNet.DataProtection
}
// build the service collection
- ServiceCollection serviceCollection = new ServiceCollection();
- serviceCollection.AddDataProtection();
- serviceCollection.ConfigureDataProtection(configurationObject =>
+ var serviceCollection = new ServiceCollection();
+ serviceCollection.AddDataProtection(configurationObject =>
{
configurationObject.PersistKeysToFileSystem(keyDirectory);
configure?.Invoke(configurationObject);
diff --git a/src/Microsoft.AspNet.DataProtection/DataProtectionServiceCollectionExtensions.cs b/src/Microsoft.AspNet.DataProtection/DataProtectionServiceCollectionExtensions.cs
index ff3d3aaac4..cd6dbbd571 100644
--- a/src/Microsoft.AspNet.DataProtection/DataProtectionServiceCollectionExtensions.cs
+++ b/src/Microsoft.AspNet.DataProtection/DataProtectionServiceCollectionExtensions.cs
@@ -30,13 +30,13 @@ namespace Microsoft.Extensions.DependencyInjection
}
///
- /// Configures the behavior of the Data Protection system.
+ /// Adds default Data Protection services to an and configures the behavior of the Data Protection system.
///
/// A service collection to which Data Protection has already been added.
/// A callback which takes a parameter.
/// This callback will be responsible for configuring the system.
/// The instance.
- public static IServiceCollection ConfigureDataProtection(this IServiceCollection services, Action configure)
+ public static IServiceCollection AddDataProtection(this IServiceCollection services, Action configure)
{
if (services == null)
{
@@ -49,7 +49,7 @@ namespace Microsoft.Extensions.DependencyInjection
}
configure(new DataProtectionConfiguration(services));
- return services;
+ return services.AddDataProtection();
}
}
}