Makes AddEntityFrameworkStores use TryAdd instead of Add
This commit is contained in:
parent
8796f7e78a
commit
741f2b1cc7
|
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue