119 references to Singleton
Aspire.Hosting (2)
DistributedApplicationBuilder.cs (1)
284_innerBuilder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IValidateOptions<DcpOptions>, ValidateDcpOptions>());
Lifecycle\LifecycleHookServiceCollectionExtensions.cs (1)
31services.TryAddEnumerable(ServiceDescriptor.Singleton<IDistributedApplicationLifecycleHook, T>());
IntegrationTestsWebsite (1)
Startup.cs (1)
25services.TryAddEnumerable(ServiceDescriptor.Singleton<IServiceMethodProvider<DynamicService>, DynamicServiceModelProvider>());
Microsoft.AspNetCore.Authentication (2)
AuthenticationBuilder.cs (2)
52Services.TryAddEnumerable(ServiceDescriptor.Singleton<IPostConfigureOptions<TOptions>, PostConfigureAuthenticationSchemeOptions<TOptions>>()); 97Services.TryAddEnumerable(ServiceDescriptor.Singleton<IPostConfigureOptions<TOptions>, EnsureSignInScheme<TOptions>>());
Microsoft.AspNetCore.Authentication.BearerToken (1)
BearerTokenExtensions.cs (1)
68builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<JsonOptions>, BearerTokenConfigureJsonOptions>());
Microsoft.AspNetCore.Authentication.Cookies (1)
CookieExtensions.cs (1)
79builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IPostConfigureOptions<CookieAuthenticationOptions>, PostConfigureCookieAuthenticationOptions>());
Microsoft.AspNetCore.Authentication.JwtBearer (2)
JwtBearerExtensions.cs (2)
77builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<JwtBearerOptions>, JwtBearerConfigureOptions>()); 78builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IPostConfigureOptions<JwtBearerOptions>, JwtBearerPostConfigureOptions>());
Microsoft.AspNetCore.Authentication.Negotiate (1)
NegotiateExtensions.cs (1)
71builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IPostConfigureOptions<NegotiateOptions>, PostConfigureNegotiateOptions>());
Microsoft.AspNetCore.Authentication.OAuth (1)
OAuthExtensions.cs (1)
62builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IPostConfigureOptions<TOptions>, OAuthPostConfigureOptions<TOptions, THandler>>());
Microsoft.AspNetCore.Authentication.OpenIdConnect (2)
OpenIdConnectExtensions.cs (2)
71builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<OpenIdConnectOptions>, OpenIdConnectConfigureOptions>()); 72builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IPostConfigureOptions<OpenIdConnectOptions>, OpenIdConnectPostConfigureOptions>());
Microsoft.AspNetCore.Authentication.Twitter (1)
TwitterExtensions.cs (1)
69builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IPostConfigureOptions<TwitterOptions>, TwitterPostConfigureOptions>());
Microsoft.AspNetCore.Authentication.WsFederation (1)
WsFederationExtensions.cs (1)
53builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IPostConfigureOptions<WsFederationOptions>, WsFederationPostConfigureOptions>());
Microsoft.AspNetCore.Components.Server (3)
DependencyInjection\ComponentServiceCollectionExtensions.cs (3)
58services.TryAddEnumerable(ServiceDescriptor.Singleton<IHubProtocol, BlazorPackHubProtocol>()); 87services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<CircuitOptions>, CircuitOptionsJSInteropDetailedErrorsConfiguration>()); 88services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<CircuitOptions>, CircuitOptionsJavaScriptInitializersConfiguration>());
Microsoft.AspNetCore.DataProtection (4)
DataProtectionBuilderExtensions.cs (1)
521builder.Services.Replace(ServiceDescriptor.Singleton<IDataProtectionProvider, EphemeralDataProtectionProvider>());
DataProtectionServiceCollectionExtensions.cs (3)
69ServiceDescriptor.Singleton<IConfigureOptions<KeyManagementOptions>, KeyManagementOptionsSetup>()); 71ServiceDescriptor.Singleton<IPostConfigureOptions<KeyManagementOptions>, KeyManagementOptionsPostSetup>()); 77services.TryAddEnumerable(ServiceDescriptor.Singleton<IHostedService, DataProtectionHostedService>());
Microsoft.AspNetCore.Diagnostics.Middleware (2)
Latency\RequestLatencyTelemetryServiceCollectionExtensions.cs (1)
73services.TryAddEnumerable(ServiceDescriptor.Singleton<IStartupFilter, CapturePipelineEntryStartupFilter>());
Logging\HttpLoggingServiceCollectionExtensions.cs (1)
40services.TryAddEnumerable(ServiceDescriptor.Singleton<IHttpLoggingInterceptor, HttpLoggingRedactionInterceptor>());
Microsoft.AspNetCore.Grpc.JsonTranscoding (1)
GrpcJsonTranscodingServiceExtensions.cs (1)
29builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<GrpcJsonTranscodingOptions>, GrpcJsonTranscodingOptionsSetup>());
Microsoft.AspNetCore.Http.Connections (1)
ConnectionsDependencyInjectionExtensions.cs (1)
25services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<ConnectionOptions>, ConnectionOptionsSetup>());
Microsoft.AspNetCore.Http.Extensions (2)
ProblemDetailsServiceCollectionExtensions.cs (2)
42services.TryAddEnumerable(ServiceDescriptor.Singleton<IProblemDetailsWriter, DefaultProblemDetailsWriter>()); 44services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<JsonOptions>, ProblemDetailsJsonOptionsSetup>());
Microsoft.AspNetCore.HttpLogging (1)
HttpLoggingServicesExtensions.cs (1)
54services.TryAddEnumerable(ServiceDescriptor.Singleton<IHttpLoggingInterceptor, T>());
Microsoft.AspNetCore.Identity (3)
IdentityBuilderExtensions.cs (2)
46builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IPostConfigureOptions<SecurityStampValidatorOptions>, PostConfigureSecurityStampValidatorOptions>()); 102builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<JsonOptions>, IdentityEndpointsJsonOptionsSetup>());
IdentityServiceCollectionExtensions.cs (1)
101services.TryAddEnumerable(ServiceDescriptor.Singleton<IPostConfigureOptions<SecurityStampValidatorOptions>, PostConfigureSecurityStampValidatorOptions>());
Microsoft.AspNetCore.Mvc (2)
MvcServiceCollectionExtensions.cs (2)
146ServiceDescriptor.Singleton<IActionDescriptorChangeProvider, HotReloadService>()); 317ServiceDescriptor.Singleton<IActionDescriptorChangeProvider, HotReloadService>());
Microsoft.AspNetCore.Mvc.Core (6)
DependencyInjection\MvcCoreServiceCollectionExtensions.cs (6)
167services.TryAddEnumerable(ServiceDescriptor.Singleton<MatcherPolicy, ActionConstraintMatcherPolicy>()); 194ServiceDescriptor.Singleton<IFilterProvider, DefaultFilterProvider>()); 263services.TryAddEnumerable(ServiceDescriptor.Singleton<MatcherPolicy, DynamicControllerEndpointMatcherPolicy>()); 264services.TryAddEnumerable(ServiceDescriptor.Singleton<IRequestDelegateFactory, ControllerRequestDelegateFactory>()); 273services.TryAddEnumerable(ServiceDescriptor.Singleton<IStartupFilter, MiddlewareFilterBuilderStartupFilter>()); 277services.TryAddEnumerable(ServiceDescriptor.Singleton<IProblemDetailsWriter, DefaultApiProblemDetailsWriter>());
Microsoft.AspNetCore.Mvc.FunctionalTests (1)
Infrastructure\MvcWebApplicationBuilderExtensions.cs (1)
34services.TryAddEnumerable(ServiceDescriptor.Singleton<IStartupFilter, CultureReplacerStartupFilter>());
Microsoft.AspNetCore.Mvc.Localization (1)
MvcLocalizationServices.cs (1)
41services.TryAdd(ServiceDescriptor.Singleton<IHtmlLocalizerFactory, HtmlLocalizerFactory>());
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation (4)
DependencyInjection\RazorRuntimeCompilationMvcCoreBuilderExtensions.cs (4)
86ServiceDescriptor.Singleton<IActionDescriptorProvider, PageActionDescriptorProvider>()); 87services.TryAddEnumerable(ServiceDescriptor.Singleton<MatcherPolicy, PageLoaderMatcherPolicy>()); 120ServiceDescriptor.Singleton<IPageRouteModelProvider, RazorProjectPageRouteModelProvider>()); 123ServiceDescriptor.Singleton<IActionDescriptorChangeProvider, PageActionDescriptorChangeProvider>());
Microsoft.AspNetCore.Mvc.RazorPages (11)
DependencyInjection\MvcRazorPagesMvcCoreBuilderExtensions.cs (11)
89services.TryAddEnumerable(ServiceDescriptor.Singleton<MatcherPolicy, DynamicPageEndpointMatcherPolicy>()); 105ServiceDescriptor.Singleton<IActionDescriptorProvider, CompiledPageActionDescriptorProvider>()); 108ServiceDescriptor.Singleton<IPageRouteModelProvider, CompiledPageRouteModelProvider>()); 110services.TryAddEnumerable(ServiceDescriptor.Singleton<MatcherPolicy, DynamicPageEndpointMatcherPolicy>()); 113ServiceDescriptor.Singleton<IPageApplicationModelProvider, DefaultPageApplicationModelProvider>()); 115ServiceDescriptor.Singleton<IPageApplicationModelProvider, AutoValidateAntiforgeryPageApplicationModelProvider>()); 117ServiceDescriptor.Singleton<IPageApplicationModelProvider, AuthorizationPageApplicationModelProvider>()); 119ServiceDescriptor.Singleton<IPageApplicationModelProvider, TempDataFilterPageApplicationModelProvider>()); 121ServiceDescriptor.Singleton<IPageApplicationModelProvider, ViewDataAttributePageApplicationModelProvider>()); 123ServiceDescriptor.Singleton<IPageApplicationModelProvider, ResponseCacheFilterApplicationModelProvider>()); 128ServiceDescriptor.Singleton<IActionInvokerProvider, PageActionInvokerProvider>());
Microsoft.AspNetCore.Mvc.ViewFeatures (1)
DependencyInjection\MvcViewFeaturesMvcBuilderExtensions.cs (1)
53builder.Services.Replace(ServiceDescriptor.Singleton<IViewComponentActivator, ServiceBasedViewComponentActivator>());
Microsoft.AspNetCore.OpenApi (1)
Extensions\OpenApiServiceCollectionExtensions.cs (1)
114services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<JsonOptions>, OpenApiSchemaJsonOptions>());
Microsoft.AspNetCore.Routing (5)
DependencyInjection\RoutingServiceCollectionExtensions.cs (5)
31services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<RouteOptions>, RegexInlineRouteConstraintSetup>()); 105services.TryAddEnumerable(ServiceDescriptor.Singleton<MatcherPolicy, HttpMethodMatcherPolicy>()); 106services.TryAddEnumerable(ServiceDescriptor.Singleton<MatcherPolicy, HostMatcherPolicy>()); 107services.TryAddEnumerable(ServiceDescriptor.Singleton<MatcherPolicy, AcceptsMatcherPolicy>()); 108services.TryAddEnumerable(ServiceDescriptor.Singleton<MatcherPolicy, ContentEncodingNegotiationMatcherPolicy>());
Microsoft.AspNetCore.SignalR (1)
SignalRDependencyInjectionExtensions.cs (1)
46services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<HubOptions>, HubOptionsSetup>());
Microsoft.AspNetCore.SignalR.Protocols.Json (1)
JsonProtocolDependencyInjectionExtensions.cs (1)
38builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IHubProtocol, JsonHubProtocol>());
Microsoft.AspNetCore.SignalR.Protocols.MessagePack (1)
MessagePackProtocolDependencyInjectionExtensions.cs (1)
41builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IHubProtocol, MessagePackHubProtocol>());
Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson (1)
NewtonsoftJsonProtocolDependencyInjectionExtensions.cs (1)
41builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IHubProtocol, NewtonsoftJsonHubProtocol>());
Microsoft.AspNetCore.SignalR.Tests (2)
AddSignalRTests.cs (2)
178serviceCollection.TryAddEnumerable(ServiceDescriptor.Singleton<IHubProtocol, CustomHubProtocol>()); 179serviceCollection.TryAddEnumerable(ServiceDescriptor.Singleton<IHubProtocol, MessagePackHubProtocol>());
Microsoft.AspNetCore.SpaProxy (1)
SpaHostingStartup.cs (1)
29services.TryAddEnumerable(ServiceDescriptor.Singleton<IStartupFilter, SpaProxyStartupFilter>());
Microsoft.Extensions.Caching.Memory (2)
MemoryCacheServiceCollectionExtensions.cs (2)
27services.TryAdd(ServiceDescriptor.Singleton<IMemoryCache, MemoryCache>()); 71services.TryAdd(ServiceDescriptor.Singleton<IDistributedCache, MemoryDistributedCache>());
Microsoft.Extensions.Caching.SqlServer (1)
SqlServerCachingServicesExtensions.cs (1)
37services.Add(ServiceDescriptor.Singleton<IDistributedCache, SqlServerCache>());
Microsoft.Extensions.Caching.StackExchangeRedis (1)
StackExchangeRedisCacheServiceCollectionExtensions.cs (1)
32services.Add(ServiceDescriptor.Singleton<IDistributedCache, RedisCacheImpl>());
Microsoft.Extensions.DependencyInjection.AutoActivation (2)
AutoActivationExtensions.cs (2)
281services.TryAddAndActivate<TService>(ServiceDescriptor.Singleton<TService, TService>()); 296services.TryAddAndActivate<TService>(ServiceDescriptor.Singleton<TService, TImplementation>());
Microsoft.Extensions.Diagnostics.Abstractions (1)
Metrics\MetricsBuilderExtensions.Listeners.cs (1)
25builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IMetricsListener, T>());
Microsoft.Extensions.Diagnostics.ExceptionSummarization (1)
ExceptionSummarizationBuilder.cs (1)
22Services.TryAddEnumerable(ServiceDescriptor.Singleton<IExceptionSummaryProvider, T>());
Microsoft.Extensions.Diagnostics.HealthChecks (1)
DependencyInjection\HealthCheckServiceCollectionExtensions.cs (1)
29services.TryAddEnumerable(ServiceDescriptor.Singleton<IHostedService, HealthCheckPublisherHostedService>());
Microsoft.Extensions.Diagnostics.ResourceMonitoring (1)
ResourceMonitorBuilder.cs (1)
35Services.TryAddEnumerable(ServiceDescriptor.Singleton<IResourceUtilizationPublisher, T>());
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests (3)
Linux\AcceptanceTest.cs (3)
127.Replace(ServiceDescriptor.Singleton<ILinuxUtilizationParser, LinuxUtilizationParserCgroupV1>()) 175.Replace(ServiceDescriptor.Singleton<ILinuxUtilizationParser, LinuxUtilizationParserCgroupV2>()) 317.Replace(ServiceDescriptor.Singleton<ILinuxUtilizationParser, LinuxUtilizationParserCgroupV2>()))
Microsoft.Extensions.Diagnostics.Testing (2)
Logging\FakeLoggerBuilderExtensions.cs (2)
30builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<ILoggerProvider, FakeLoggerProvider>()); 48builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<ILoggerProvider, FakeLoggerProvider>());
Microsoft.Extensions.Hosting.Abstractions (1)
ServiceCollectionHostedServiceExtensions.cs (1)
25services.TryAddEnumerable(ServiceDescriptor.Singleton<IHostedService, THostedService>());
Microsoft.Extensions.Http (2)
DependencyInjection\HttpClientFactoryServiceCollectionExtensions.cs (2)
53services.TryAddEnumerable(ServiceDescriptor.Singleton<IHttpMessageHandlerBuilderFilter, LoggingHttpMessageHandlerBuilderFilter>()); 55services.TryAddEnumerable(ServiceDescriptor.Singleton<IHttpMessageHandlerBuilderFilter, MetricsFactoryHttpMessageHandlerFilter>());
Microsoft.Extensions.Http.Diagnostics.PerformanceTests (6)
HttpClientFactory.cs (6)
18services.TryAddEnumerable(ServiceDescriptor.Singleton<ILoggerProvider, DropMessageLoggerProvider>()); 42services.TryAddEnumerable(ServiceDescriptor.Singleton<ILoggerProvider, DropMessageLoggerProvider>()); 65services.TryAddEnumerable(ServiceDescriptor.Singleton<ILoggerProvider, DropMessageLoggerProvider>()); 92services.TryAddEnumerable(ServiceDescriptor.Singleton<ILoggerProvider, DropMessageLoggerProvider>()); 115services.TryAddEnumerable(ServiceDescriptor.Singleton<ILoggerProvider, DropMessageLoggerProvider>()); 138services.TryAddEnumerable(ServiceDescriptor.Singleton<ILoggerProvider, DropMessageLoggerProvider>());
Microsoft.Extensions.Http.Resilience (1)
Resilience\ResilienceHttpClientBuilderExtensions.Resilience.cs (1)
150public static readonly ServiceDescriptor ServiceDescriptor = ServiceDescriptor.Singleton<Marker, Marker>();
Microsoft.Extensions.Logging (1)
LoggingServiceCollectionExtensions.cs (1)
38services.TryAdd(ServiceDescriptor.Singleton<ILoggerFactory, LoggerFactory>());
Microsoft.Extensions.Logging.AzureAppServices (2)
AzureAppServicesLoggerFactoryExtensions.cs (2)
59var addedFileLogger = TryAddEnumerable(services, Singleton<ILoggerProvider, FileLoggerProvider>()); 60var addedBlobLogger = TryAddEnumerable(services, Singleton<ILoggerProvider, BlobLoggerProvider>());
Microsoft.Extensions.Logging.Configuration (2)
LoggerProviderConfigurationExtensions.cs (2)
29services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<TOptions>, LoggerProviderConfigureOptions<TOptions, TProvider>>()); 30services.TryAddEnumerable(ServiceDescriptor.Singleton<IOptionsChangeTokenSource<TOptions>, LoggerProviderOptionsChangeTokenSource<TOptions, TProvider>>());
Microsoft.Extensions.Logging.Console (6)
ConsoleLoggerExtensions.cs (6)
38builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<ILoggerProvider, ConsoleLoggerProvider>()); 40builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<ConsoleLoggerOptions>, ConsoleLoggerConfigureOptions>()); 41builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IOptionsChangeTokenSource<ConsoleLoggerOptions>, LoggerProviderOptionsChangeTokenSource<ConsoleLoggerOptions, ConsoleLoggerProvider>>()); 164builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<ConsoleFormatter, TFormatter>()); 165builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<TOptions>, TConfigureOptions>()); 166builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IOptionsChangeTokenSource<TOptions>, ConsoleLoggerFormatterOptionsChangeTokenSource<TFormatter, TOptions>>());
Microsoft.Extensions.Logging.Debug (1)
DebugLoggerFactoryExtensions.cs (1)
53builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<ILoggerProvider, DebugLoggerProvider>());
Microsoft.Extensions.Logging.EventLog (1)
EventLoggerFactoryExtensions.cs (1)
60builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<ILoggerProvider, EventLogLoggerProvider>());
Microsoft.Extensions.Logging.EventSource (3)
EventSourceLoggerFactoryExtensions.cs (3)
44builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<ILoggerProvider, EventSourceLoggerProvider>()); 45builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<LoggerFilterOptions>, EventLogFiltersConfigureOptions>()); 46builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IOptionsChangeTokenSource<LoggerFilterOptions>, EventLogFiltersConfigureOptionsChangeSource>());
Microsoft.Extensions.ML (1)
ServiceCollectionExtensions.cs (1)
83.TryAddEnumerable(ServiceDescriptor.Singleton<IPostConfigureOptions<MLOptions>, PostMLContextOptionsConfiguration>());
Microsoft.Extensions.Options (1)
OptionsServiceCollectionExtensions.cs (1)
72services.AddOptions().TryAddEnumerable(ServiceDescriptor.Singleton<IValidateOptions<TOptions>, TValidateOptions>());
Microsoft.Extensions.ServiceDiscovery (1)
ServiceDiscoveryHttpClientBuilderExtensions.cs (1)
47services.TryAddEnumerable(ServiceDescriptor.Singleton<IHttpMessageHandlerBuilderFilter, DisableGrpcLoadBalancingFilter>());
Microsoft.Extensions.Telemetry (4)
Logging\LoggingEnrichmentExtensions.cs (2)
37builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<ILoggerFactory, ExtendedLoggerFactory>()); 55builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<ILoggerFactory, ExtendedLoggerFactory>());
Logging\LoggingRedactionExtensions.cs (2)
37builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<ILoggerFactory, ExtendedLoggerFactory>()); 54builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<ILoggerFactory, ExtendedLoggerFactory>());