Merge remote-tracking branch 'edz/EFStoreTryAdd' into dev

This commit is contained in:
Hao Kung 2015-06-23 12:18:48 -07:00
commit 3e3fcb54a8
1 changed files with 2 additions and 2 deletions

View File

@ -12,7 +12,7 @@ namespace Microsoft.Framework.DependencyInjection
public static IdentityBuilder AddEntityFrameworkStores<TContext>(this IdentityBuilder builder) public static IdentityBuilder AddEntityFrameworkStores<TContext>(this IdentityBuilder builder)
where TContext : DbContext where TContext : DbContext
{ {
builder.Services.Add(IdentityEntityFrameworkServices.GetDefaultServices(builder.UserType, builder.RoleType, typeof(TContext))); builder.Services.TryAdd(IdentityEntityFrameworkServices.GetDefaultServices(builder.UserType, builder.RoleType, typeof(TContext)));
return builder; return builder;
} }
@ -20,7 +20,7 @@ namespace Microsoft.Framework.DependencyInjection
where TContext : DbContext where TContext : DbContext
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
{ {
builder.Services.Add(IdentityEntityFrameworkServices.GetDefaultServices(builder.UserType, builder.RoleType, typeof(TContext), typeof(TKey))); builder.Services.TryAdd(IdentityEntityFrameworkServices.GetDefaultServices(builder.UserType, builder.RoleType, typeof(TContext), typeof(TKey)));
return builder; return builder;
} }
} }