56 references to TryAdd
Microsoft.AspNetCore.Authorization (6)
AuthorizationServiceCollectionExtensions.cs (6)
32
services.
TryAdd
(ServiceDescriptor.Singleton<AuthorizationMetrics, AuthorizationMetrics>());
33
services.
TryAdd
(ServiceDescriptor.Transient<IAuthorizationService, DefaultAuthorizationServiceImpl>());
34
services.
TryAdd
(ServiceDescriptor.Transient<IAuthorizationPolicyProvider, DefaultAuthorizationPolicyProvider>());
35
services.
TryAdd
(ServiceDescriptor.Transient<IAuthorizationHandlerProvider, DefaultAuthorizationHandlerProvider>());
36
services.
TryAdd
(ServiceDescriptor.Transient<IAuthorizationEvaluator, DefaultAuthorizationEvaluator>());
37
services.
TryAdd
(ServiceDescriptor.Transient<IAuthorizationHandlerContextFactory, DefaultAuthorizationHandlerContextFactory>());
Microsoft.AspNetCore.Cors (2)
CorsServiceCollectionExtensions.cs (2)
25
services.
TryAdd
(ServiceDescriptor.Transient<ICorsService, CorsService>());
26
services.
TryAdd
(ServiceDescriptor.Transient<ICorsPolicyProvider, DefaultCorsPolicyProvider>());
Microsoft.AspNetCore.Mvc.Core (1)
DependencyInjection\MvcCoreServiceCollectionExtensions.cs (1)
209
services.
TryAdd
(ServiceDescriptor.Transient<ICompositeMetadataDetailsProvider>(s =>
Microsoft.AspNetCore.Mvc.Localization (3)
MvcLocalizationServices.cs (3)
41
services.
TryAdd
(ServiceDescriptor.Singleton<IHtmlLocalizerFactory, HtmlLocalizerFactory>());
42
services.
TryAdd
(ServiceDescriptor.Transient(typeof(IHtmlLocalizer<>), typeof(HtmlLocalizer<>)));
43
services.
TryAdd
(ServiceDescriptor.Transient<IViewLocalizer, ViewLocalizer>());
Microsoft.AspNetCore.Routing (1)
DependencyInjection\RoutingServiceCollectionExtensions.cs (1)
59
services.
TryAdd
(ServiceDescriptor.Transient<TreeRouteBuilder>(s =>
Microsoft.Extensions.Caching.Memory (2)
MemoryCacheServiceCollectionExtensions.cs (2)
27
services.
TryAdd
(ServiceDescriptor.Singleton<IMemoryCache, MemoryCache>());
71
services.
TryAdd
(ServiceDescriptor.Singleton<IDistributedCache, MemoryDistributedCache>());
Microsoft.Extensions.DependencyInjection.Abstractions (27)
Extensions\ServiceCollectionDescriptorExtensions.cs (14)
95
collection.
TryAdd
(d);
114
TryAdd
(collection, descriptor);
136
TryAdd
(collection, descriptor);
158
TryAdd
(collection, descriptor);
208
services.
TryAdd
(ServiceDescriptor.Transient(implementationFactory));
226
TryAdd
(collection, descriptor);
248
TryAdd
(collection, descriptor);
270
TryAdd
(collection, descriptor);
320
services.
TryAdd
(ServiceDescriptor.Scoped(implementationFactory));
338
TryAdd
(collection, descriptor);
360
TryAdd
(collection, descriptor);
382
TryAdd
(collection, descriptor);
434
TryAdd
(collection, descriptor);
451
services.
TryAdd
(ServiceDescriptor.Singleton(implementationFactory));
Extensions\ServiceCollectionDescriptorExtensions.Keyed.cs (13)
29
ServiceCollectionDescriptorExtensions.
TryAdd
(collection, descriptor);
53
ServiceCollectionDescriptorExtensions.
TryAdd
(collection, descriptor);
77
ServiceCollectionDescriptorExtensions.
TryAdd
(collection, descriptor);
131
services.
TryAdd
(ServiceDescriptor.KeyedTransient(serviceKey, implementationFactory));
151
ServiceCollectionDescriptorExtensions.
TryAdd
(collection, descriptor);
175
ServiceCollectionDescriptorExtensions.
TryAdd
(collection, descriptor);
199
ServiceCollectionDescriptorExtensions.
TryAdd
(collection, descriptor);
253
services.
TryAdd
(ServiceDescriptor.KeyedScoped(serviceKey, implementationFactory));
273
ServiceCollectionDescriptorExtensions.
TryAdd
(collection, descriptor);
297
ServiceCollectionDescriptorExtensions.
TryAdd
(collection, descriptor);
321
ServiceCollectionDescriptorExtensions.
TryAdd
(collection, descriptor);
376
ServiceCollectionDescriptorExtensions.
TryAdd
(collection, descriptor);
395
services.
TryAdd
(ServiceDescriptor.KeyedSingleton(serviceKey, implementationFactory));
Microsoft.Extensions.Http (2)
DependencyInjection\HttpClientFactoryServiceCollectionExtensions.cs (2)
47
services.
TryAdd
(ServiceDescriptor.Transient(typeof(ITypedHttpClientFactory<>), typeof(DefaultTypedHttpClientFactory<>)));
48
services.
TryAdd
(ServiceDescriptor.Singleton(typeof(DefaultTypedHttpClientFactory<>.Cache), typeof(DefaultTypedHttpClientFactory<>.Cache)));
Microsoft.Extensions.Logging (2)
LoggingServiceCollectionExtensions.cs (2)
38
services.
TryAdd
(ServiceDescriptor.Singleton<ILoggerFactory, LoggerFactory>());
39
services.
TryAdd
(ServiceDescriptor.Singleton(typeof(ILogger<>), typeof(Logger<>)));
Microsoft.Extensions.Options (5)
OptionsServiceCollectionExtensions.cs (5)
26
services.
TryAdd
(ServiceDescriptor.Singleton(typeof(IOptions<>), typeof(UnnamedOptionsManager<>)));
27
services.
TryAdd
(ServiceDescriptor.Scoped(typeof(IOptionsSnapshot<>), typeof(OptionsManager<>)));
28
services.
TryAdd
(ServiceDescriptor.Singleton(typeof(IOptionsMonitor<>), typeof(OptionsMonitor<>)));
29
services.
TryAdd
(ServiceDescriptor.Transient(typeof(IOptionsFactory<>), typeof(OptionsFactory<>)));
30
services.
TryAdd
(ServiceDescriptor.Singleton(typeof(IOptionsMonitorCache<>), typeof(OptionsCache<>)));
Microsoft.Extensions.Options.Contextual (3)
..\..\..\..\src\Libraries\Microsoft.Extensions.Options.Contextual\ContextualOptionsServiceCollectionExtensions.cs (3)
29
services.
TryAdd
(ServiceDescriptor.Singleton(typeof(IContextualOptionsFactory<>), typeof(ContextualOptionsFactory<>)));
30
services.
TryAdd
(ServiceDescriptor.Singleton(typeof(IContextualOptions<,>), typeof(ContextualOptions<,>)));
31
services.
TryAdd
(ServiceDescriptor.Singleton(typeof(INamedContextualOptions<,>), typeof(ContextualOptions<,>)));
Microsoft.Maui (2)
Hosting\MauiAppBuilder.cs (2)
179
Services.
TryAdd
(ServiceDescriptor.Singleton<ILoggerFactory, NullLoggerFactory>());
180
Services.
TryAdd
(ServiceDescriptor.Singleton(typeof(ILogger<>), typeof(NullLogger<>)));