471 references to AddSingleton
ApiExplorerWebSite (1)
Startup.cs (1)
34services.AddSingleton<IActionDescriptorChangeProvider, ActionDescriptorChangeProvider>();
aspire (14)
Program.cs (14)
112builder.Services.AddSingleton<IProjectLocator, ProjectLocator>(); 113builder.Services.AddSingleton<IProjectUpdater, ProjectUpdater>(); 114builder.Services.AddSingleton<INewCommandPrompter, NewCommandPrompter>(); 115builder.Services.AddSingleton<IAddCommandPrompter, AddCommandPrompter>(); 116builder.Services.AddSingleton<IPublishCommandPrompter, PublishCommandPrompter>(); 117builder.Services.AddSingleton<ICertificateService, CertificateService>(); 119builder.Services.AddSingleton<IFeatures, Features>(); 122builder.Services.AddSingleton<IDotNetSdkInstaller, DotNetSdkInstaller>(); 124builder.Services.AddSingleton<INuGetPackageCache, NuGetPackageCache>(); 127builder.Services.AddSingleton<ICliUpdateNotifier, CliUpdateNotifier>(); 128builder.Services.AddSingleton<IPackagingService, PackagingService>(); 132builder.Services.AddSingleton<ITemplateProvider, TemplateProvider>(); 238builder.Services.AddSingleton<IExtensionRpcTarget, ExtensionRpcTarget>(); 239builder.Services.AddSingleton<IExtensionBackchannel, ExtensionBackchannel>();
Aspire.Cli.Tests (4)
Utils\CliUpdateNotificationServiceTests.cs (4)
241services.AddSingleton<INuGetPackageCache, TestNuGetPackageCache>(); 242services.AddSingleton<ICliUpdateNotifier, CliUpdateNotifier>(); 266services.AddSingleton<INuGetPackageCache, TestNuGetPackageCache>(); 267services.AddSingleton<ICliUpdateNotifier, CliUpdateNotifier>();
Aspire.Components.Common.TestUtilities (2)
ConformanceTests.cs (2)
278builder.Services.AddSingleton<ILoggerFactory, TestLoggerFactory>(); 285builder.Services.AddSingleton<ILoggerFactory, TestLoggerFactory>();
Aspire.Dashboard (6)
DashboardWebApplication.cs (6)
162builder.Services.AddSingleton<IPostConfigureOptions<DashboardOptions>, PostConfigureDashboardOptions>(); 163builder.Services.AddSingleton<IValidateOptions<DashboardOptions>, ValidateDashboardOptions>(); 194builder.Services.AddSingleton<IPolicyEvaluator, AspirePolicyEvaluator>(); 259builder.Services.AddSingleton<ILoggerProvider, TelemetryLoggerProvider>(); 281builder.Services.AddSingleton<IInstrumentUnitResolver, DefaultInstrumentUnitResolver>(); 288builder.Services.AddSingleton<IKnownPropertyLookup, KnownPropertyLookup>();
Aspire.Dashboard.Components.Tests (60)
Controls\ApplicationNameTests.cs (2)
25Services.AddSingleton<IDashboardClient, DashboardClient>(); 42Services.AddSingleton<IDashboardClient, DashboardClient>();
Interactions\InteractionsProviderTests.cs (1)
493Services.AddSingleton<IDashboardTelemetrySender, TestDashboardTelemetrySender>();
Layout\MainLayoutTests.cs (7)
133Services.AddSingleton<IDialogService, DialogService>(); 134Services.AddSingleton<IDashboardClient, TestDashboardClient>(); 136Services.AddSingleton<IThemeResolver, TestThemeResolver>(); 138Services.AddSingleton<BrowserTimeProvider, TestTimeProvider>(); 141Services.AddSingleton<ITooltipService, TooltipService>(); 142Services.AddSingleton<IToastService, ToastService>(); 145Services.AddSingleton<IDashboardTelemetrySender, TestDashboardTelemetrySender>();
Pages\ConsoleLogsTests.cs (7)
823Services.AddSingleton<IMessageService, MessageService>(); 824Services.AddSingleton<IToastService, ToastService>(); 829Services.AddSingleton<IDialogService, DialogService>(); 830Services.AddSingleton<ISessionStorage, TestSessionStorage>(); 831Services.AddSingleton<ILocalStorage, TestLocalStorage>(); 834Services.AddSingleton<IKeyCodeService, KeyCodeService>(); 839Services.AddSingleton<IDashboardTelemetrySender, TestDashboardTelemetrySender>();
Pages\LoginTests.cs (2)
67Services.AddSingleton<IKeyCodeService, KeyCodeService>(); 68Services.AddSingleton<IDashboardTelemetrySender, TestDashboardTelemetrySender>();
Pages\StructuredLogsTests.cs (7)
235Services.AddSingleton<BrowserTimeProvider, TestTimeProvider>(); 238Services.AddSingleton<IMessageService, MessageService>(); 242Services.AddSingleton<IDialogService, DialogService>(); 244Services.AddSingleton<ISessionStorage, TestSessionStorage>(); 245Services.AddSingleton<ILocalStorage, TestLocalStorage>(); 248Services.AddSingleton<IKeyCodeService, KeyCodeService>(); 250Services.AddSingleton<IDashboardTelemetrySender, TestDashboardTelemetrySender>();
Pages\TraceDetailsTests.cs (7)
668Services.AddSingleton<BrowserTimeProvider, TestTimeProvider>(); 671Services.AddSingleton<IMessageService, MessageService>(); 675Services.AddSingleton<IDialogService, DialogService>(); 676Services.AddSingleton<ISessionStorage, TestSessionStorage>(); 677Services.AddSingleton<ILocalStorage, TestLocalStorage>(); 680Services.AddSingleton<IKeyCodeService, KeyCodeService>(); 681Services.AddSingleton<IDashboardTelemetrySender, TestDashboardTelemetrySender>();
Shared\MetricsSetupHelpers.cs (10)
43context.Services.AddSingleton<IInstrumentUnitResolver, TestInstrumentUnitResolver>(); 44context.Services.AddSingleton<BrowserTimeProvider, TestTimeProvider>(); 47context.Services.AddSingleton<IDialogService, DialogService>(); 87context.Services.AddSingleton<IMessageService, MessageService>(); 90context.Services.AddSingleton<IDialogService, DialogService>(); 91context.Services.AddSingleton<BrowserTimeProvider, TestTimeProvider>(); 93context.Services.AddSingleton<ILocalStorage, TestLocalStorage>(); 96context.Services.AddSingleton<IKeyCodeService, KeyCodeService>(); 97context.Services.AddSingleton<IThemeResolver, TestThemeResolver>(); 99context.Services.AddSingleton<IDashboardTelemetrySender, TestDashboardTelemetrySender>();
Shared\ResourceSetupHelpers.cs (12)
27context.Services.AddSingleton<IInstrumentUnitResolver, TestInstrumentUnitResolver>(); 28context.Services.AddSingleton<BrowserTimeProvider, TestTimeProvider>(); 30context.Services.AddSingleton<IDialogService, DialogService>(); 32context.Services.AddSingleton<IKeyCodeService, KeyCodeService>(); 33context.Services.AddSingleton<IDashboardTelemetrySender, TestDashboardTelemetrySender>(); 100context.Services.AddSingleton<BrowserTimeProvider, TestTimeProvider>(); 103context.Services.AddSingleton<IMessageService, MessageService>(); 107context.Services.AddSingleton<IDialogService, DialogService>(); 109context.Services.AddSingleton<ISessionStorage, TestSessionStorage>(); 110context.Services.AddSingleton<ILocalStorage, TestLocalStorage>(); 113context.Services.AddSingleton<IKeyCodeService, KeyCodeService>(); 117context.Services.AddSingleton<IDashboardTelemetrySender, TestDashboardTelemetrySender>();
Shared\StructuredLogsSetupHelpers.cs (5)
20context.Services.AddSingleton<IInstrumentUnitResolver, TestInstrumentUnitResolver>(); 21context.Services.AddSingleton<BrowserTimeProvider, TestTimeProvider>(); 23context.Services.AddSingleton<IDialogService, DialogService>(); 25context.Services.AddSingleton<IKeyCodeService, KeyCodeService>(); 27context.Services.AddSingleton<IDashboardTelemetrySender, TestDashboardTelemetrySender>();
Aspire.Dashboard.Tests (2)
Integration\Playwright\Infrastructure\DashboardServerFixture.cs (1)
59builder.Services.AddSingleton<IDashboardClient, MockDashboardClient>();
Telemetry\TelemetryLoggerProviderTests.cs (1)
24.AddSingleton<ILoggerProvider, TelemetryLoggerProvider>()
Aspire.Hosting (10)
Dashboard\DashboardServiceHost.cs (1)
85builder.Services.AddSingleton<IValidateOptions<ResourceServiceOptions>, ValidateResourceServiceOptions>();
DistributedApplicationBuilder.cs (8)
172_innerBuilder.Services.AddSingleton<ILoggerProvider, BackchannelLoggerProvider>(); 242_innerBuilder.Services.AddSingleton<IPackageFetcher, PackageFetcher>(); 243_innerBuilder.Services.AddSingleton<IPackageVersionProvider, PackageVersionProvider>(); 346_innerBuilder.Services.AddSingleton<IDashboardEndpointProvider, HostDashboardEndpointProvider>(); 376_innerBuilder.Services.AddSingleton<IDcpExecutor, DcpExecutor>(); 379_innerBuilder.Services.AddSingleton<IDcpDependencyCheckService, DcpDependencyCheck>(); 384_innerBuilder.Services.AddSingleton<IKubernetesService, KubernetesService>(); 395_innerBuilder.Services.AddSingleton<IResourceContainerImageBuilder, ResourceContainerImageBuilder>();
Lifecycle\LifecycleHookServiceCollectionExtensions.cs (1)
21services.AddSingleton<IDistributedApplicationLifecycleHook, T>();
Aspire.Hosting.Azure (2)
Provisioning\AzureProvisionerExtensions.cs (2)
51builder.Services.AddSingleton<IProvisioningContextProvider, PublishModeProvisioningContextProvider>(); 55builder.Services.AddSingleton<IProvisioningContextProvider, RunModeProvisioningContextProvider>();
Aspire.Hosting.Azure.Tests (3)
AzureDeployerTests.cs (3)
514builder.Services.AddSingleton<IProvisioningContextProvider, PublishModeProvisioningContextProvider>(); 515builder.Services.AddSingleton<IUserSecretsManager, NoOpUserSecretsManager>(); 521builder.Services.AddSingleton<IResourceContainerImageBuilder, MockImageBuilder>();
Aspire.Hosting.Docker.Tests (19)
DockerComposePublisherTests.cs (14)
24builder.Services.AddSingleton<IResourceContainerImageBuilder, MockImageBuilder>(); 114builder.Services.AddSingleton<IResourceContainerImageBuilder, MockImageBuilder>(); 146builder.Services.AddSingleton<IResourceContainerImageBuilder, MockImageBuilder>(); 173builder.Services.AddSingleton<IResourceContainerImageBuilder, MockImageBuilder>(); 178builder.Services.AddSingleton<IResourceContainerImageBuilder, MockImageBuilder>(); 204builder.Services.AddSingleton<IResourceContainerImageBuilder, MockImageBuilder>(); 260builder.Services.AddSingleton<IResourceContainerImageBuilder, MockImageBuilder>(); 291builder.Services.AddSingleton<IResourceContainerImageBuilder, MockImageBuilder>(); 329builder.Services.AddSingleton<IResourceContainerImageBuilder, MockImageBuilder>(); 355builder.Services.AddSingleton<IResourceContainerImageBuilder, MockImageBuilder>(); 381builder.Services.AddSingleton<IResourceContainerImageBuilder, MockImageBuilder>(); 407builder.Services.AddSingleton<IResourceContainerImageBuilder, MockImageBuilder>(); 435builder.Services.AddSingleton<IResourceContainerImageBuilder, MockImageBuilder>(); 467builder.Services.AddSingleton<IResourceContainerImageBuilder, MockImageBuilder>();
DockerComposeTests.cs (5)
23builder.Services.AddSingleton<IResourceContainerImageBuilder, MockImageBuilder>(); 44builder.Services.AddSingleton<IResourceContainerImageBuilder, MockImageBuilder>(); 67builder.Services.AddSingleton<IResourceContainerImageBuilder, MockImageBuilder>(); 126builder.Services.AddSingleton<IResourceContainerImageBuilder, MockImageBuilder>(); 151builder.Services.AddSingleton<IResourceContainerImageBuilder, MockImageBuilder>();
Aspire.Hosting.Tests (6)
Dashboard\DashboardResourceTests.cs (6)
90builder.Services.AddSingleton<IDashboardEndpointProvider, MockDashboardEndpointProvider>(); 205builder.Services.AddSingleton<IDashboardEndpointProvider, MockDashboardEndpointProvider>(); 246builder.Services.AddSingleton<IDashboardEndpointProvider, MockDashboardEndpointProvider>(); 282builder.Services.AddSingleton<IDashboardEndpointProvider, MockDashboardEndpointProvider>(); 319builder.Services.AddSingleton<IDashboardEndpointProvider, MockDashboardEndpointProvider>(); 365builder.Services.AddSingleton<IDashboardEndpointProvider, MockDashboardEndpointProvider>();
Aspire.OpenAI.Tests (2)
AspireOpenAIClientBuilderChatClientExtensionsTests.cs (1)
237builder.Services.AddSingleton<ILoggerFactory, TestLoggerFactory>();
AspireOpenAIClientBuilderEmbeddingGeneratorExtensionsTests.cs (1)
237builder.Services.AddSingleton<ILoggerFactory, TestLoggerFactory>();
BasicTestApp (1)
Program.cs (1)
38builder.Services.AddSingleton<AuthenticationStateProvider, ServerAuthenticationStateProvider>();
BasicWebSite (4)
Startup.cs (1)
24services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();
StartupWithoutEndpointRouting.cs (3)
43services.AddSingleton<IActionDescriptorProvider, ActionDescriptorCreationCounter>(); 48services.AddSingleton<ICustomService, DefaultCustomService>(); 53services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();
ClientSample (1)
Tcp\TcpHubConnectionBuilderExtensions.cs (1)
40builder.Services.AddSingleton<IConnectionFactory, TcpConnectionFactory>();
Cookies (1)
Startup.cs (1)
44services.AddSingleton<IConfigureOptions<CookieAuthenticationOptions>, ConfigureMyCookie>();
CookieSessionSample (1)
Startup.cs (1)
21services.AddSingleton<ITicketStore, MemoryCacheTicketStore>();
CustomPolicyProvider (2)
Startup.cs (2)
20services.AddSingleton<IAuthorizationPolicyProvider, MinimumAgePolicyProvider>(); 23services.AddSingleton<IAuthorizationHandler, MinimumAgeAuthorizationHandler>();
GenericHostWebSite (1)
Startup.cs (1)
27services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();
GetDocument.Insider (2)
Commands\GetDocumentCommandWorker.cs (2)
73services.AddSingleton<IServer, NoopServer>(); 74services.AddSingleton<IHostLifetime, NoopHostLifetime>();
HostedBlazorWebassemblyApp.Server (1)
Startup.cs (1)
33services.AddSingleton<IWeatherForecastService, WeatherForecastService>();
http2cat (1)
src\Shared\Http2cat\Http2CatIServiceCollectionExtensions.cs (1)
16services.AddSingleton<IConnectionFactory, SocketConnectionFactory>();
Identity.DefaultUI.WebSite (2)
PocoUserStartup.cs (1)
26services.AddSingleton<IUserStore<Microsoft.AspNetCore.Identity.Test.PocoUser>, InMemoryUserStore<Microsoft.AspNetCore.Identity.Test.PocoUser>>();
StartupBase.cs (1)
47services.AddSingleton<IFileVersionProvider, FileVersionProvider>();
Identity.ExternalClaims (1)
Startup.cs (1)
70services.AddSingleton<IEmailSender, EmailSender>();
IdentitySample.PasskeyConformance (2)
Program.cs (2)
31builder.Services.AddSingleton<IUserStore<PocoUser>, InMemoryUserStore<PocoUser>>(); 32builder.Services.AddSingleton<IUserPasskeyStore<PocoUser>, InMemoryUserStore<PocoUser>>();
IdentitySample.PasskeyUI (2)
Program.cs (2)
37builder.Services.AddSingleton<IUserStore<PocoUser>, InMemoryUserStore<PocoUser>>(); 38builder.Services.AddSingleton<IUserPasskeyStore<PocoUser>, InMemoryUserStore<PocoUser>>();
IIS.FunctionalTests (1)
src\Shared\Http2cat\Http2CatIServiceCollectionExtensions.cs (1)
16services.AddSingleton<IConnectionFactory, SocketConnectionFactory>();
IIS.LongTests (1)
src\Shared\Http2cat\Http2CatIServiceCollectionExtensions.cs (1)
16services.AddSingleton<IConnectionFactory, SocketConnectionFactory>();
IIS.NewHandler.FunctionalTests (1)
src\Shared\Http2cat\Http2CatIServiceCollectionExtensions.cs (1)
16services.AddSingleton<IConnectionFactory, SocketConnectionFactory>();
IIS.NewShim.FunctionalTests (1)
src\Shared\Http2cat\Http2CatIServiceCollectionExtensions.cs (1)
16services.AddSingleton<IConnectionFactory, SocketConnectionFactory>();
IISExpress.FunctionalTests (1)
src\Shared\Http2cat\Http2CatIServiceCollectionExtensions.cs (1)
16services.AddSingleton<IConnectionFactory, SocketConnectionFactory>();
InMemory.FunctionalTests (4)
HttpsConnectionMiddlewareTests.cs (2)
42.AddSingleton<IHttpsConfigurationService, HttpsConfigurationService>() 43.AddSingleton<HttpsConfigurationService.IInitializer, HttpsConfigurationService.Initializer>()
TestTransport\TestServer.cs (2)
91services.AddSingleton<IHttpsConfigurationService, HttpsConfigurationService>(); 92services.AddSingleton<HttpsConfigurationService.IInitializer, HttpsConfigurationService.Initializer>();
InProcessWebSite (1)
Program.cs (1)
109.ConfigureServices(services => services.AddSingleton<IServer, DummyServer>())
IStartupInjectionAssemblyName (1)
Program.cs (1)
26.ConfigureServices(services => services.AddSingleton<IStartup, Startup>());
Microsoft.AspNetCore.Authentication.Certificate (1)
CertificateAuthenticationExtensions.cs (1)
90builder.Services.AddSingleton<ICertificateValidationCache, CertificateValidationCache>();
Microsoft.AspNetCore.Authentication.Core.Test (1)
AuthenticationSchemeProviderTests.cs (1)
179.AddSingleton<IAuthenticationSchemeProvider, IgnoreCaseSchemeProvider>()
Microsoft.AspNetCore.Authentication.Test (1)
CookieTests.cs (1)
1860s.AddSingleton<IClaimsTransformation, ClaimsTransformer>();
Microsoft.AspNetCore.Authorization.Test (8)
DefaultAuthorizationServiceTests.cs (6)
1019services.AddSingleton<IAuthorizationPolicyProvider, StaticPolicyProvider>(); 1058services.AddSingleton<IAuthorizationPolicyProvider, DynamicPolicyProvider>(); 1084services.AddSingleton<IAuthorizationEvaluator, SuccessEvaluator>(); 1125services.AddSingleton<IAuthorizationHandlerContextFactory, BadContextMaker>(); 1144services.AddSingleton<IAuthorizationHandlerProvider, SadHandlerProvider>(); 1233services.AddSingleton<IAuthorizationHandler, FailHandler>();
PolicyEvaluatorTests.cs (2)
19var services = new ServiceCollection().AddSingleton<IAuthenticationService, SadAuthentication>(); 36var services = new ServiceCollection().AddSingleton<IAuthenticationService, EchoAuthentication>();
Microsoft.AspNetCore.Components.Authorization.Tests (2)
AuthorizeRouteViewTest.cs (2)
32serviceCollection.AddSingleton<IAuthorizationPolicyProvider, TestAuthorizationPolicyProvider>(); 34serviceCollection.AddSingleton<NavigationManager, TestNavigationManager>();
Microsoft.AspNetCore.Components.Endpoints.Tests (10)
EndpointHtmlRendererTest.cs (5)
1847services.AddSingleton<IJSRuntime, UnsupportedJavaScriptRuntime>(); 1848services.AddSingleton<NavigationManager, HttpNavigationManager>(); 1849services.AddSingleton<ILoggerFactory, NullLoggerFactory>(); 1850services.AddSingleton<ILogger<ComponentStatePersistenceManager>, NullLogger<ComponentStatePersistenceManager>>(); 1858services.AddSingleton<AntiforgeryStateProvider, EndpointAntiforgeryStateProvider>();
HotReloadServiceTests.cs (1)
223services.AddSingleton<IWebHostEnvironment, TestWebHostEnvironment>();
RazorComponentEndpointDataSourceTest.cs (1)
226services.AddSingleton<IWebHostEnvironment, TestWebHostEnvironment>();
RazorComponentResultTest.cs (3)
461.AddSingleton<NavigationManager, FakeNavigationManager>() 464.AddSingleton<IDataProtectionProvider, FakeDataProtectionProvider>() 468.AddSingleton<AntiforgeryStateProvider, EndpointAntiforgeryStateProvider>()
Microsoft.AspNetCore.Components.Tests (11)
PersistentValueProviderComponentSubscriptionTests.cs (1)
316.AddSingleton<PersistentComponentStateSerializer<CustomData>, TestCustomDataSerializer>()
Routing\RouterTest.cs (10)
28services.AddSingleton<INavigationInterception, TestNavigationInterception>(); 29services.AddSingleton<IScrollToLocationHash, TestScrollToLocationHash>(); 278services.AddSingleton<INavigationInterception, TestNavigationInterception>(); 279services.AddSingleton<IScrollToLocationHash, TestScrollToLocationHash>(); 313services.AddSingleton<INavigationInterception, TestNavigationInterception>(); 314services.AddSingleton<IScrollToLocationHash, TestScrollToLocationHash>(); 360services.AddSingleton<INavigationInterception, TestNavigationInterception>(); 361services.AddSingleton<IScrollToLocationHash, TestScrollToLocationHash>(); 412services.AddSingleton<INavigationInterception, TestNavigationInterception>(); 413services.AddSingleton<IScrollToLocationHash, TestScrollToLocationHash>();
Microsoft.AspNetCore.Components.Web.Tests (4)
Forms\EditFormTest.cs (2)
20services.AddSingleton<IFormValueMapper, TestFormValueModelBinder>(); 25services.AddSingleton<AntiforgeryStateProvider, DefaultAntiforgeryStateProvider>();
Forms\Mapping\FormMappingScopeTest.cs (1)
19serviceCollection.AddSingleton<IFormValueMapper, TestFormValueMapper>();
HtmlRendering\HtmlRendererTest.cs (1)
1097})).AddSingleton<IFormValueMapper, TestFormValueMapper>());
Microsoft.AspNetCore.Components.WebAssembly (2)
Hosting\WebAssemblyHostBuilder.cs (2)
330Services.AddSingleton<IErrorBoundaryLogger, WebAssemblyErrorBoundaryLogger>(); 337Services.AddSingleton<AntiforgeryStateProvider, DefaultAntiforgeryStateProvider>();
Microsoft.AspNetCore.ConcurrencyLimiter (2)
QueuePolicies\QueuePolicyServiceCollectionExtensions.cs (2)
23services.AddSingleton<IQueuePolicy, QueuePolicy>(); 37services.AddSingleton<IQueuePolicy, StackPolicy>();
Microsoft.AspNetCore.Diagnostics (1)
ExceptionHandler\ExceptionHandlerServiceCollectionExtensions.cs (1)
53return services.AddSingleton<IExceptionHandler, T>();
Microsoft.AspNetCore.Diagnostics.Tests (7)
DeveloperExceptionPageMiddlewareTest.cs (7)
383services.AddSingleton<IDeveloperPageExceptionFilter, ExceptionMessageFilter>(); 417services.AddSingleton<IDeveloperPageExceptionFilter, PassThroughExceptionFilter>(); 418services.AddSingleton<IDeveloperPageExceptionFilter, AlwaysBadFormatExceptionFilter>(); 419services.AddSingleton<IDeveloperPageExceptionFilter, ExceptionMessageFilter>(); 455services.AddSingleton<IDeveloperPageExceptionFilter, AlwaysThrowSameMessageFilter>(); 456services.AddSingleton<IDeveloperPageExceptionFilter, ExceptionMessageFilter>(); 457services.AddSingleton<IDeveloperPageExceptionFilter, ExceptionToStringFilter>();
Microsoft.AspNetCore.Grpc.Swagger.Tests (3)
GrpcSwaggerServiceExtensionsTests.cs (2)
30services.AddSingleton<IWebHostEnvironment, TestWebHostEnvironment>(); 66services.AddSingleton<IWebHostEnvironment, TestWebHostEnvironment>();
Infrastructure\OpenApiTestHelpers.cs (1)
30services.AddSingleton<IWebHostEnvironment, TestWebHostEnvironment>();
Microsoft.AspNetCore.HeaderParsing (2)
HeaderParsingServiceCollectionExtensions.cs (2)
30.AddSingleton<IHttpContextAccessor, HttpContextAccessor>() 31.AddSingleton<IHeaderRegistry, HeaderRegistry>()
Microsoft.AspNetCore.Hosting (2)
GenericHost\GenericWebHostBuilder.cs (1)
61services.AddSingleton<IApplicationLifetime, GenericWebHostApplicationLifetime>();
GenericHost\SlimWebHostBuilder.cs (1)
37services.AddSingleton<IApplicationLifetime, GenericWebHostApplicationLifetime>();
Microsoft.AspNetCore.Hosting.Tests (31)
Fakes\StartupWithConfigureServices.cs (1)
13services.AddSingleton<IFoo, Foo>();
StartupManagerTests.cs (24)
20serviceCollection.AddSingleton<IServiceProviderFactory<IServiceCollection>, DefaultServiceProviderFactory>(); 42serviceCollection.AddSingleton<IServiceProviderFactory<IServiceCollection>, DefaultServiceProviderFactory>(); 64serviceCollection.AddSingleton<IServiceProviderFactory<IServiceCollection>, DefaultServiceProviderFactory>(); 88serviceCollection.AddSingleton<IServiceProviderFactory<MyContainer>, MyContainerFactory>(); 110serviceCollection.AddSingleton<IServiceProviderFactory<MyContainer>, MyContainerFactory>(); 132serviceCollection.AddSingleton<IServiceProviderFactory<MyContainer>, MyContainerFactory>(); 293serviceCollection.AddSingleton<IServiceProviderFactory<IServiceCollection>, DefaultServiceProviderFactory>(); 344.AddSingleton<IServiceProviderFactory<IServiceCollection>, DefaultServiceProviderFactory>() 363serviceCollection.AddSingleton<IServiceProviderFactory<IServiceCollection>, DefaultServiceProviderFactory>(); 391.AddSingleton<IServiceProviderFactory<IServiceCollection>, DefaultServiceProviderFactory>() 410serviceCollection.AddSingleton<IServiceProviderFactory<IServiceCollection>, DefaultServiceProviderFactory>(); 424serviceCollection.AddSingleton<IServiceProviderFactory<IServiceCollection>, DefaultServiceProviderFactory>(); 439serviceCollection.AddSingleton<IServiceProviderFactory<IServiceCollection>, DefaultServiceProviderFactory>(); 453serviceCollection.AddSingleton<IServiceProviderFactory<IServiceCollection>, DefaultServiceProviderFactory>(); 470serviceCollection.AddSingleton<IServiceProviderFactory<IServiceCollection>, DefaultServiceProviderFactory>(); 488serviceCollection.AddSingleton<IServiceProviderFactory<IServiceCollection>, DefaultServiceProviderFactory>(); 506serviceCollection.AddSingleton<IServiceProviderFactory<IServiceCollection>, DefaultServiceProviderFactory>(); 521serviceCollection.AddSingleton<IServiceProviderFactory<IServiceCollection>, DefaultServiceProviderFactory>(); 535serviceCollection.AddSingleton<IServiceProviderFactory<IServiceCollection>, DefaultServiceProviderFactory>(); 550serviceCollection.AddSingleton<IServiceProviderFactory<MyContainer>, MyContainerFactory>(); 566serviceCollection.AddSingleton<IServiceProviderFactory<MyContainer>, MyContainerFactory>(); 582serviceCollection.AddSingleton<IServiceProviderFactory<MyContainer>, MyContainerFactory>(); 618serviceCollection.AddSingleton<IServiceProviderFactory<MyContainer>, MyContainerFactory>(); 628serviceCollection.AddSingleton<IServiceProviderFactory<MyContainer>, MyBadContainerFactory>();
WebHostBuilderTests.cs (2)
1297services.AddSingleton<IStartupFilter, MyStartupFilter>(); 1407services.AddSingleton<IServer, ServerMustBeStartedSecond>();
WebHostTests.cs (4)
379s.AddSingleton<IFakeSingletonService, FakeService>(); 529services.AddSingleton<IHostedService, TestHostedService>(); 1072services.AddSingleton<IHostedService, TestHostedService>(); 1461return builder.ConfigureServices(services => services.AddSingleton<IServer, WebHostTests.FakeServer>());
Microsoft.AspNetCore.Http.Connections.Tests (2)
HttpConnectionDispatcherTests.cs (2)
3510services.AddSingleton<IDataProtectionProvider, EphemeralDataProtectionProvider>(); 3664services.AddSingleton<IDataProtectionProvider, EphemeralDataProtectionProvider>();
Microsoft.AspNetCore.Http.Results.Tests (18)
BadRequestOfTResultTests.cs (1)
184services.AddSingleton<ILoggerFactory, NullLoggerFactory>();
BadRequestResultTests.cs (1)
97services.AddSingleton<ILoggerFactory, NullLoggerFactory>();
ConflictOfTResultTests.cs (1)
162services.AddSingleton<ILoggerFactory, NullLoggerFactory>();
ConflictResultTests.cs (1)
98services.AddSingleton<ILoggerFactory, NullLoggerFactory>();
CreatedAtRouteOfTResultTests.cs (1)
193services.AddSingleton<ILoggerFactory, NullLoggerFactory>();
CreatedAtRouteResultTests.cs (1)
139services.AddSingleton<ILoggerFactory, NullLoggerFactory>();
CreatedOfTResultTests.cs (1)
190services.AddSingleton<ILoggerFactory, NullLoggerFactory>();
CreatedResultTests.cs (1)
127services.AddSingleton<ILoggerFactory, NullLoggerFactory>();
FileContentResultTests.cs (1)
31.AddSingleton<ILoggerFactory, NullLoggerFactory>()
HttpResultsHelperTests.cs (1)
245services.AddSingleton<ILoggerFactory, NullLoggerFactory>();
InternalServerErrorOfTResultTests.cs (1)
184services.AddSingleton<ILoggerFactory, NullLoggerFactory>();
InternalServerErrorResultTests.cs (1)
95services.AddSingleton<ILoggerFactory, NullLoggerFactory>();
NotFoundOfTResultTests.cs (1)
153services.AddSingleton<ILoggerFactory, NullLoggerFactory>();
NotFoundResultTests.cs (1)
100services.AddSingleton<ILoggerFactory, NullLoggerFactory>();
OkOfTResultTests.cs (1)
161services.AddSingleton<ILoggerFactory, NullLoggerFactory>();
OkResultTests.cs (1)
96services.AddSingleton<ILoggerFactory, NullLoggerFactory>();
UnprocessableEntityOfTResultTests.cs (1)
161services.AddSingleton<ILoggerFactory, NullLoggerFactory>();
UnprocessableEntityResultTests.cs (1)
97services.AddSingleton<ILoggerFactory, NullLoggerFactory>();
Microsoft.AspNetCore.Identity.EntityFrameworkCore.Test (1)
SqlStoreTestBase.cs (1)
55services.AddSingleton<IDataProtectionProvider, EphemeralDataProtectionProvider>();
Microsoft.AspNetCore.Identity.FunctionalTests (1)
RegistrationTests.cs (1)
76services.AddSingleton<IEmailSender, FakeEmailSender>();
Microsoft.AspNetCore.Identity.InMemory.Test (4)
ControllerTest.cs (4)
37services.AddSingleton<IUserStore<PocoUser>, InMemoryStore<PocoUser, PocoRole>>(); 38services.AddSingleton<IRoleStore<PocoRole>, InMemoryStore<PocoUser, PocoRole>>(); 88services.AddSingleton<IUserStore<PocoUser>, InMemoryStore<PocoUser, PocoRole>>(); 89services.AddSingleton<IRoleStore<PocoRole>, InMemoryStore<PocoUser, PocoRole>>();
Microsoft.AspNetCore.Identity.Specification.Tests (2)
IdentitySpecificationTestBase.cs (1)
43services.AddSingleton<IDataProtectionProvider, EphemeralDataProtectionProvider>();
UserManagerSpecificationTests.cs (1)
56services.AddSingleton<IDataProtectionProvider, EphemeralDataProtectionProvider>();
Microsoft.AspNetCore.Mvc.Core.Test (17)
FileContentResultTest.cs (1)
35.AddSingleton<IActionResultExecutor<FileContentResult>, FileContentResultExecutor>()
FileStreamResultTest.cs (2)
25.AddSingleton<ILoggerFactory, NullLoggerFactory>() 26.AddSingleton<IActionResultExecutor<FileStreamResult>, FileStreamResultExecutor>()
LocalRedirectResultTest.cs (2)
139serviceCollection.AddSingleton<IActionResultExecutor<LocalRedirectResult>, LocalRedirectResultExecutor>(); 140serviceCollection.AddSingleton<IUrlHelperFactory, UrlHelperFactory>();
ModelBinding\Binders\BinderTypeModelBinderTest.cs (1)
36.AddSingleton<IModelBinder, NullModelBinder>()
ModelBinding\Binders\HeaderModelBinderTests.cs (1)
342services.AddSingleton<ILoggerFactory, NullLoggerFactory>();
ModelBinding\TestModelBinderProviderContext.cs (1)
100services.AddSingleton<ILoggerFactory, NullLoggerFactory>();
PhysicalFileResultTest.cs (1)
59services.AddSingleton<IActionResultExecutor<PhysicalFileResult>, TestPhysicalFileResultExecutor>();
RedirectResultTest.cs (2)
28serviceCollection.AddSingleton<IActionResultExecutor<RedirectResult>, RedirectResultExecutor>(); 29serviceCollection.AddSingleton<IUrlHelperFactory, UrlHelperFactory>();
RedirectToActionResultTest.cs (2)
150services.AddSingleton<IActionResultExecutor<RedirectToActionResult>, RedirectToActionResultExecutor>(); 151services.AddSingleton<IUrlHelperFactory, UrlHelperFactory>();
RedirectToPageResultTest.cs (2)
295services.AddSingleton<IActionResultExecutor<RedirectToPageResult>, RedirectToPageResultExecutor>(); 303services.AddSingleton<IUrlHelperFactory, UrlHelperFactory>();
RedirectToRouteResultTest.cs (2)
178services.AddSingleton<IActionResultExecutor<RedirectToRouteResult>, RedirectToRouteResultExecutor>(); 186services.AddSingleton<IUrlHelperFactory, UrlHelperFactory>();
Microsoft.AspNetCore.Mvc.Core.TestCommon (1)
TestModelBinderFactory.cs (1)
83services.AddSingleton<ILoggerFactory, NullLoggerFactory>();
Microsoft.AspNetCore.Mvc.DataAnnotations.Test (2)
MvcDataAnnotationsMvcOptionsSetup.cs (2)
20services.AddSingleton<IValidationAttributeAdapterProvider, ValidationAttributeAdapterProvider>(); 23services.AddSingleton<IConfigureOptions<MvcOptions>, MvcDataAnnotationsMvcOptionsSetup>();
Microsoft.AspNetCore.Mvc.FunctionalTests (2)
TestingInfrastructureTests.cs (2)
28builder.ConfigureTestServices(s => s.AddSingleton<TestService, OverridenService>()); 187builder.ConfigureTestServices(s => s.AddSingleton<GenericHostWebSite.TestGenericService, OverridenGenericService>()));
Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test (3)
DependencyInjection\NewtonsoftJsonMvcCoreBuilderExtensionsTest.cs (3)
38.AddSingleton<IJsonHelper, SystemTextJsonHelper>(); 53.AddSingleton<TempDataSerializer, DefaultTempDataSerializer>(); 68.AddSingleton<IActionResultExecutor<JsonResult>, SystemTextJsonResultExecutor>();
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation.Test (2)
DependencyInjection\RazorRuntimeCompilationMvcCoreBuilderExtensionsTest.cs (2)
19.AddSingleton<IViewCompilerProvider, DefaultViewCompilerProvider>(); 36.AddSingleton<IActionDescriptorProvider, CompiledPageActionDescriptorProvider>();
Microsoft.AspNetCore.Mvc.RazorPages.Test (3)
DependencyInjection\MvcRazorPagesMvcBuilderExtensionsTest.cs (1)
19.AddSingleton<IConfigureOptions<RazorPagesOptions>, RazorPagesOptionsSetup>();
Filters\PageSaveTempDataPropertyFilterFactoryTest.cs (1)
36serviceCollection.AddSingleton<ITempDataDictionaryFactory, TempDataDictionaryFactory>();
Infrastructure\PageActionInvokerTest.cs (1)
1501services.AddSingleton<PageResultExecutor, TestPageResultExecutor>();
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (16)
Filters\ControllerSaveTempDataPropertyFilterFactoryTest.cs (1)
32serviceCollection.AddSingleton<ITempDataDictionaryFactory, TempDataDictionaryFactory>();
Rendering\DefaultTemplatesUtilities.cs (1)
274.AddSingleton<IViewBufferScope, TestViewBufferScope>()
ViewComponentResultTest.cs (14)
666services.AddSingleton<IViewComponentSelector, DefaultViewComponentSelector>(); 667services.AddSingleton<IViewComponentDescriptorCollectionProvider, DefaultViewComponentDescriptorCollectionProvider>(); 668services.AddSingleton<IViewComponentInvokerFactory, DefaultViewComponentInvokerFactory>(); 669services.AddSingleton<ITypeActivatorCache, TypeActivatorCache>(); 670services.AddSingleton<IViewComponentActivator, DefaultViewComponentActivator>(); 671services.AddSingleton<IViewComponentFactory, DefaultViewComponentFactory>(); 673services.AddSingleton<IModelMetadataProvider, EmptyModelMetadataProvider>(); 675services.AddSingleton<ITempDataDictionaryFactory, TempDataDictionaryFactory>(); 676services.AddSingleton<ITempDataProvider, SessionStateTempDataProvider>(); 677services.AddSingleton<TempDataSerializer, DefaultTempDataSerializer>(); 678services.AddSingleton<HtmlEncoder, HtmlTestEncoder>(); 679services.AddSingleton<IViewBufferScope, TestViewBufferScope>(); 680services.AddSingleton<IActionResultExecutor<ViewComponentResult>, ViewComponentResultExecutor>(); 681services.AddSingleton<IHttpResponseStreamWriterFactory, TestHttpResponseStreamWriterFactory>();
Microsoft.AspNetCore.OpenApi (1)
Extensions\OpenApiServiceCollectionExtensions.cs (1)
117services.AddSingleton<IDocumentProvider, OpenApiDocumentProvider>();
Microsoft.AspNetCore.OpenApi.SourceGenerators.Tests (2)
SnapshotTestHelper.cs (2)
155services.AddSingleton<IServer, NoopServer>(); 156services.AddSingleton<IHostLifetime, NoopHostLifetime>();
Microsoft.AspNetCore.OutputCaching.StackExchangeRedis (1)
StackExchangeRedisCacheServiceCollectionExtensions.cs (1)
34services.AddSingleton<AspNetCore.OutputCaching.IOutputCacheStore, RedisOutputCacheStoreImpl>();
Microsoft.AspNetCore.Routing.Tests (4)
DefaultLinkGeneratorTest.cs (1)
731services.AddSingleton<IEndpointAddressScheme<int>, IntAddressScheme>();
DefaultLinkParserTest.cs (1)
160services.AddSingleton<IEndpointAddressScheme<int>, IntAddressScheme>();
RouteTest.cs (1)
1763services.AddSingleton<ParameterPolicyFactory, DefaultParameterPolicyFactory>();
TemplateParserDefaultValuesTests.cs (1)
131services.AddSingleton<ParameterPolicyFactory, DefaultParameterPolicyFactory>();
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (1)
src\Shared\Http2cat\Http2CatIServiceCollectionExtensions.cs (1)
16services.AddSingleton<IConnectionFactory, SocketConnectionFactory>();
Microsoft.AspNetCore.Server.IIS (2)
WebHostBuilderIISExtensions.cs (2)
40services.AddSingleton<IServer, IISHttpServer>(); 42services.AddSingleton<IStartupFilter, IISServerSetupFilter>();
Microsoft.AspNetCore.Server.Kestrel (3)
WebHostBuilderKestrelExtensions.cs (3)
39services.AddSingleton<HttpsConfigurationService.IInitializer, HttpsConfigurationService.Initializer>(); 85services.AddSingleton<IHttpsConfigurationService, HttpsConfigurationService>(); 86services.AddSingleton<IServer, KestrelServerImpl>();
Microsoft.AspNetCore.Server.Kestrel.Tests (2)
KestrelConfigurationLoaderTests.cs (2)
31.AddSingleton<IHttpsConfigurationService, HttpsConfigurationService>() 32.AddSingleton<HttpsConfigurationService.IInitializer, HttpsConfigurationService.Initializer>()
Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes (1)
WebHostBuilderNamedPipeExtensions.cs (1)
35services.AddSingleton<IConnectionListenerFactory, NamedPipeTransportFactory>();
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic (1)
WebHostBuilderQuicExtensions.cs (1)
27services.AddSingleton<IMultiplexedConnectionListenerFactory, QuicTransportFactory>();
Microsoft.AspNetCore.SignalR (1)
SignalRDependencyInjectionExtensions.cs (1)
27signalrBuilder.Services.AddSingleton<IConfigureOptions<HubOptions<THub>>, HubOptionsSetup<THub>>();
Microsoft.AspNetCore.SignalR.Client (3)
HubConnectionBuilderHttpExtensions.cs (3)
158hubConnectionBuilder.Services.AddSingleton<EndPoint, HttpConnectionOptionsDerivedHttpEndPoint>(); 161hubConnectionBuilder.Services.AddSingleton<IConfigureOptions<HttpConnectionOptions>, HubProtocolDerivedHttpOptionsConfigurer>(); 164hubConnectionBuilder.Services.AddSingleton<IConnectionFactory, HttpConnectionFactory>();
Microsoft.AspNetCore.SignalR.Client.FunctionalTests (3)
Startup.cs (2)
35services.AddSingleton<IUserIdProvider, HeaderUserIdProvider>(); 67services.AddSingleton<IDataProtectionProvider, EphemeralDataProtectionProvider>();
VersionStartup.cs (1)
30services.AddSingleton<IDataProtectionProvider, EphemeralDataProtectionProvider>();
Microsoft.AspNetCore.SignalR.StackExchangeRedis.Tests (1)
Startup.cs (1)
27services.AddSingleton<IUserIdProvider, UserNameIdProvider>();
Microsoft.AspNetCore.SignalR.Tests (7)
AddSignalRTests.cs (4)
29serviceCollection.AddSingleton<IUserIdProvider, CustomIdProvider>(); 31serviceCollection.AddSingleton<IHubProtocolResolver, CustomHubProtocolResolver>(); 57serviceCollection.AddSingleton<IUserIdProvider, CustomIdProvider>(); 59serviceCollection.AddSingleton<IHubProtocolResolver, CustomHubProtocolResolver>();
HubConnectionHandlerTests.cs (1)
2340services.AddSingleton<IAuthorizationHandler, TestAuthHandler>();
Startup.cs (2)
70services.AddSingleton<IAuthorizationHandler, TestAuthHandler>(); 74services.AddSingleton<IDataProtectionProvider, EphemeralDataProtectionProvider>();
Microsoft.AspNetCore.TestHost (4)
WebHostBuilderExtensions.cs (4)
30services.AddSingleton<IHostLifetime, NoopHostLifetime>(); 31services.AddSingleton<IServer, TestServer>(); 46services.AddSingleton<IHostLifetime, NoopHostLifetime>(); 47services.AddSingleton<IServer, TestServer>();
Microsoft.AspNetCore.TestHost.Tests (3)
TestServerTests.cs (3)
137.ConfigureServices(s => s.AddSingleton<IServiceProviderFactory<ThirdPartyContainer>, ThirdPartyContainerServiceProviderFactory>()) 717services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>(); 757services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
Microsoft.AspNetCore.Tests (6)
WebApplicationTests.cs (6)
1499services.AddSingleton<IService, Service>(); 1556builder.Services.AddSingleton<IHostLifetime, CustomHostLifetime>(); 1668builder.Services.AddSingleton<IStartupFilter, TerminalMiddlewareStartupFilter>(); 1690builder.Services.AddSingleton<IStartupFilter, UseRoutingStartupFilter>(); 2017builder.Services.AddSingleton<IStartupFilter, PropertyFilter>(); 2053builder.Services.AddSingleton<IStartupFilter, ThrowingStartupFilter>();
Microsoft.CommonLanguageServerProtocol.Framework.Example (5)
ExampleLanguageServer.cs (5)
31.AddSingleton<AbstractRequestContextFactory<ExampleRequestContext>, ExampleRequestContextFactory>() 33.AddSingleton<IInitializeManager<InitializeParams, InitializeResult>, CapabilitiesManager>() 55.AddSingleton<IMethodHandler, MultiRegisteringHandler>() 56.AddSingleton<IMethodHandler, InitializeHandler<InitializeParams, InitializeResult, ExampleRequestContext>>() 57.AddSingleton<IMethodHandler, InitializedHandler<InitializedParams, ExampleRequestContext>>();
Microsoft.CommonLanguageServerProtocol.Framework.UnitTests (1)
TestExampleLanguageServer.cs (1)
120serviceCollection.AddSingleton<IMethodHandler, ExtraDidOpenHandler>();
Microsoft.DotNet.Build.Manifest.Tests (6)
BuildModelFactoryTests.cs (6)
51.AddSingleton<IBlobArtifactModelFactory, BlobArtifactModelFactory>() 52.AddSingleton<IPackageArtifactModelFactory, PackageArtifactModelFactory>() 53.AddSingleton<IPdbArtifactModelFactory, PdbArtifactModelFactory>() 54.AddSingleton<IPackageArchiveReaderFactory, PackageArchiveReaderFactory>() 55.AddSingleton<INupkgInfoFactory, NupkgInfoFactory>() 56.AddSingleton<IFileSystem, FileSystem>()
Microsoft.DotNet.Build.Tasks.Feed.Tests (5)
PublishArtifactsInManifestTests.cs (5)
132.AddSingleton<IFileSystem, FileSystem>() 133.AddSingleton<IBuildModelFactory, BuildModelFactory>(); 159.AddSingleton<IFileSystem, FileSystem>() 160.AddSingleton<IBuildModelFactory, BuildModelFactory>() 161.AddSingleton<ITargetChannelValidator, ProductionChannelValidator>()
Microsoft.Extensions.Caching.Hybrid (2)
HybridCacheBuilderExtensions.cs (2)
36_ = Throw.IfNull(builder).Services.AddSingleton<IHybridCacheSerializer<T>, TImplementation>(); 59_ = Throw.IfNull(builder).Services.AddSingleton<IHybridCacheSerializerFactory, TImplementation>();
Microsoft.Extensions.Caching.Hybrid.Tests (10)
BufferReleaseTests.cs (2)
120services => services.AddSingleton<IDistributedCache, TestCache>()); 185services => services.AddSingleton<IDistributedCache, TestCache>());
ServiceConstructionTests.cs (4)
158services.AddSingleton<IDistributedCache, MemoryDistributedCache>(); 176services.AddSingleton<IDistributedCache, CustomMemoryDistributedCache>(); 192services.AddSingleton<IDistributedCache, MemoryDistributedCache>(); 199services.AddSingleton<IMemoryCache, CustomMemoryCache>();
SizeTests.cs (2)
156services.AddSingleton<IDistributedCache, NullDistributedCache>(); 220services.AddSingleton<IDistributedCache, NullDistributedCache>();
StampedeTests.cs (2)
18services.AddSingleton<IDistributedCache, InvalidCache>(); 19services.AddSingleton<IMemoryCache, InvalidCache>();
Microsoft.Extensions.DependencyInjection.AutoActivation (1)
AutoActivationExtensions.cs (1)
124.AddSingleton<TService, TImplementation>()
Microsoft.Extensions.Diagnostics.HealthChecks.Common (3)
CommonHealthChecksExtensions.TelemetryPublisher.cs (3)
24.AddSingleton<IHealthCheckPublisher, TelemetryHealthCheckPublisher>(); 38.AddSingleton<IHealthCheckPublisher, TelemetryHealthCheckPublisher>(); 52.AddSingleton<IHealthCheckPublisher, TelemetryHealthCheckPublisher>();
Microsoft.Extensions.Diagnostics.HealthChecks.Common.Tests (3)
TelemetryHealthChecksPublisherExtensionsTests.cs (3)
21.AddSingleton<ILoggerFactory, LoggerFactory>() 38.AddSingleton<ILoggerFactory, LoggerFactory>() 58.AddSingleton<ILoggerFactory, LoggerFactory>()
Microsoft.Extensions.Diagnostics.HealthChecks.Tests (1)
DependencyInjection\ServiceCollectionExtensionsTest.cs (1)
52services.AddSingleton<IHostedService, DummyHostedService>();
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests (6)
ResourceMonitoringExtensionsTests.cs (6)
42builder.Services.AddSingleton<ISnapshotProvider, FakeProvider>(); 80builder.Services.AddSingleton<ISnapshotProvider, FakeProvider>(); 103builder.Services.AddSingleton<ISnapshotProvider, FakeProvider>(); 132builder.Services.AddSingleton<ISnapshotProvider, FakeProvider>(); 177builder.Services.AddSingleton<ISnapshotProvider, FakeProvider>(); 200builder.Services.AddSingleton<ISnapshotProvider, FakeProvider>();
Microsoft.Extensions.Hosting (5)
HostBuilder.cs (1)
310services.AddSingleton<IHostApplicationLifetime, ApplicationLifetime>();
HostBuilder.netcoreapp.cs (2)
16services.AddSingleton<IHostLifetime, ConsoleLifetime>(); 20services.AddSingleton<IHostLifetime, NullLifetime>();
HostingHostBuilderExtensions.cs (2)
356return hostBuilder.ConfigureServices(collection => collection.AddSingleton<IHostLifetime, ConsoleLifetime>()); 374collection.AddSingleton<IHostLifetime, ConsoleLifetime>();
Microsoft.Extensions.Hosting.Systemd (2)
SystemdHostBuilderExtensions.cs (2)
88services.AddSingleton<ISystemdNotifier, SystemdNotifier>(); 89services.AddSingleton<IHostLifetime, SystemdLifetime>();
Microsoft.Extensions.Hosting.WindowsServices (2)
WindowsServiceLifetimeHostBuilderExtensions.cs (2)
120services.AddSingleton<IHostLifetime, WindowsServiceLifetime>(); 121services.AddSingleton<IConfigureOptions<EventLogSettings>, EventLogSettingsSetup>();
Microsoft.Extensions.Http.Diagnostics (1)
Http\HttpDiagnosticsServiceCollectionExtensions.cs (1)
43_ = services.AddSingleton<IDownstreamDependencyMetadata, T>();
Microsoft.Extensions.Http.Diagnostics.Tests (6)
Logging\AcceptanceTests.cs (6)
213.AddSingleton<ITestHttpClient1, TestHttpClient1>() 214.AddSingleton<ITestHttpClient2, TestHttpClient2>() 483.AddSingleton<ITestHttpClient1, TestHttpClient1>() 484.AddSingleton<ITestHttpClient2, TestHttpClient2>() 518.AddSingleton<ITestHttpClient1, TestHttpClient1>() 519.AddSingleton<ITestHttpClient2, TestHttpClient2>()
Microsoft.Extensions.Identity.Core (3)
IdentityBuilder.cs (3)
229Services.AddSingleton<IPersonalDataProtector, DefaultPersonalDataProtector>(); 230Services.AddSingleton<ILookupProtector, TProtector>(); 231Services.AddSingleton<ILookupProtectorKeyRing, TKeyRing>();
Microsoft.Extensions.Options.Contextual.Tests (1)
AcceptanceTests.cs (1)
89.AddSingleton<IWeatherForecastService, WeatherForecastService>())
Microsoft.Extensions.ServiceDiscovery (2)
ServiceDiscoveryServiceCollectionExtensions.cs (2)
96services.AddSingleton<IServiceEndpointProviderFactory, ConfigurationServiceEndpointProviderFactory>(); 116services.AddSingleton<IServiceEndpointProviderFactory, PassThroughServiceEndpointProviderFactory>();
Microsoft.Extensions.ServiceDiscovery.Dns (2)
ServiceDiscoveryDnsServiceCollectionExtensions.cs (2)
60services.AddSingleton<IServiceEndpointProviderFactory, DnsSrvServiceEndpointProviderFactory>(); 112services.AddSingleton<IServiceEndpointProviderFactory, DnsServiceEndpointProviderFactory>();
Microsoft.Extensions.ServiceDiscovery.Dns.Tests (1)
DnsServiceEndpointResolverTests.cs (1)
20.AddSingleton<IDnsResolver, DnsResolver>()
Microsoft.Extensions.ServiceDiscovery.Yarp (2)
ServiceDiscoveryReverseProxyServiceCollectionExtensions.cs (2)
23builder.Services.AddSingleton<IDestinationResolver, ServiceDiscoveryDestinationResolver>(); 45services.AddSingleton<IForwarderHttpClientFactory, ServiceDiscoveryForwarderHttpClientFactory>();
Microsoft.Extensions.Telemetry (1)
Sampling\SamplingLoggerBuilderExtensions.cs (1)
131_ = builder.Services.AddSingleton<LoggingSampler, T>();
Microsoft.Extensions.Telemetry.Abstractions (2)
Enrichment\EnrichmentServiceCollectionExtensions.cs (2)
25=> Throw.IfNull(services).AddSingleton<ILogEnricher, T>(); 46=> Throw.IfNull(services).AddSingleton<IStaticLogEnricher, T>();
Microsoft.Extensions.Validation.GeneratorTests (2)
ValidationsGeneratorTestBase.cs (2)
163services.AddSingleton<IServer, NoopServer>(); 164services.AddSingleton<IHostLifetime, NoopHostLifetime>();
Microsoft.Extensions.WebEncoders.Tests (2)
EncoderServiceCollectionExtensionsTests.cs (2)
68serviceCollection.AddSingleton<HtmlEncoder, HtmlTestEncoder>(); 69serviceCollection.AddSingleton<JavaScriptEncoder, JavaScriptTestEncoder>();
Microsoft.Maui (1)
Hosting\ImageSources\ImageSourceServiceCollectionExtensions.cs (1)
22 services.AddSingleton<IImageSourceService<TImageSource>, TImageSourceService>();
Microsoft.ML.AutoML (2)
AutoMLExperiment\AutoMLExperiment.cs (2)
131_serviceCollection.AddSingleton<IMonitor, TMonitor>(); 194_serviceCollection.AddSingleton<ITuner, TTuner>();
Mvc.RoutingWebSite (8)
Startup.cs (1)
33services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();
StartupForDynamic.cs (1)
22services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();
StartupForDynamicOrder.cs (1)
37services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();
StartupForEndpointFilters.cs (1)
21services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();
StartupForFallback.cs (1)
20services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();
StartupForGroups.cs (1)
21services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();
StartupForLinkGenerator.cs (1)
35services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();
StartupRoutingDifferentBranches.cs (1)
35services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();
RazorWebSite (2)
Startup.cs (2)
15services.AddSingleton<ITagHelperComponent, TestHeadTagHelperComponent>(); 16services.AddSingleton<ITagHelperComponent, TestBodyTagHelperComponent>();
SampleStartups (1)
StartupFullControl.cs (1)
47services.AddSingleton<IMyCustomService, MyCustomService>();
SignalR.Client.FunctionalTestApp (1)
Startup.cs (1)
101services.AddSingleton<IDataProtectionProvider, EphemeralDataProtectionProvider>();
Sockets.BindTests (3)
src\Servers\Kestrel\shared\test\TransportTestHelpers\TestServer.cs (3)
87services.AddSingleton<IHttpsConfigurationService, HttpsConfigurationService>(); 88services.AddSingleton<HttpsConfigurationService.IInitializer, HttpsConfigurationService.Initializer>(); 134services.AddSingleton<IHostApplicationLifetime, LifetimeNotImplemented>();
Sockets.FunctionalTests (3)
src\Servers\Kestrel\shared\test\TransportTestHelpers\TestServer.cs (3)
87services.AddSingleton<IHttpsConfigurationService, HttpsConfigurationService>(); 88services.AddSingleton<HttpsConfigurationService.IInitializer, HttpsConfigurationService.Initializer>(); 134services.AddSingleton<IHostApplicationLifetime, LifetimeNotImplemented>();
VersioningWebSite (1)
Startup.cs (1)
18services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();