From 0e77bbdbbd6917c7f5dce013c4c267d971c8e0f2 Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Thu, 6 Aug 2015 14:20:04 -0700 Subject: [PATCH] Used scoped instead of transient lifetimes Fixes https://github.com/aspnet/Identity/issues/519 --- .../IdentityServiceCollectionExtensions.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Microsoft.AspNet.Identity/IdentityServiceCollectionExtensions.cs b/src/Microsoft.AspNet.Identity/IdentityServiceCollectionExtensions.cs index d65386776f..d656c4b3b8 100644 --- a/src/Microsoft.AspNet.Identity/IdentityServiceCollectionExtensions.cs +++ b/src/Microsoft.AspNet.Identity/IdentityServiceCollectionExtensions.cs @@ -83,13 +83,13 @@ namespace Microsoft.Framework.DependencyInjection services.AddAuthentication(); // Identity services - services.TryAdd(ServiceDescriptor.Transient, UserValidator>()); - services.TryAdd(ServiceDescriptor.Transient, PasswordValidator>()); - services.TryAdd(ServiceDescriptor.Transient, PasswordHasher>()); - services.TryAdd(ServiceDescriptor.Transient()); - services.TryAdd(ServiceDescriptor.Transient, RoleValidator>()); + services.TryAdd(ServiceDescriptor.Scoped, UserValidator>()); + services.TryAdd(ServiceDescriptor.Scoped, PasswordValidator>()); + services.TryAdd(ServiceDescriptor.Scoped, PasswordHasher>()); + services.TryAdd(ServiceDescriptor.Scoped()); + services.TryAdd(ServiceDescriptor.Scoped, RoleValidator>()); // No interface for the error describer so we can add errors without rev'ing the interface - services.TryAdd(ServiceDescriptor.Transient()); + services.TryAdd(ServiceDescriptor.Scoped()); services.TryAdd(ServiceDescriptor.Scoped>()); services.TryAdd(ServiceDescriptor.Scoped, UserClaimsPrincipalFactory>()); services.TryAdd(ServiceDescriptor.Scoped, UserManager>());