Use TryAdd to add services rather than Add
This commit is contained in:
Родитель
d42838aaeb
Коммит
1cadc54c3b
|
@ -35,8 +35,8 @@ namespace Microsoft.Framework.DependencyInjection
|
|||
public static IServiceCollection AddCors(this IServiceCollection serviceCollection)
|
||||
{
|
||||
serviceCollection.AddOptions();
|
||||
serviceCollection.AddTransient<ICorsService, CorsService>();
|
||||
serviceCollection.AddTransient<ICorsPolicyProvider, DefaultCorsPolicyProvider>();
|
||||
serviceCollection.TryAdd(ServiceDescriptor.Transient<ICorsService, CorsService>());
|
||||
serviceCollection.TryAdd(ServiceDescriptor.Transient<ICorsPolicyProvider, DefaultCorsPolicyProvider>());
|
||||
return serviceCollection;
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче