383 references to AddSingleton
ApiExplorerWebSite (1)
Startup.cs (1)
33services.AddSingleton<IActionDescriptorChangeProvider, ActionDescriptorChangeProvider>();
Aspire.Components.Common.Tests (2)
ConformanceTests.cs (2)
267builder.Services.AddSingleton<ILoggerFactory, TestLoggerFactory>(); 274builder.Services.AddSingleton<ILoggerFactory, TestLoggerFactory>();
Aspire.Dashboard (3)
DashboardWebApplication.cs (3)
162builder.Services.AddSingleton<IPostConfigureOptions<DashboardOptions>, PostConfigureDashboardOptions>(); 163builder.Services.AddSingleton<IValidateOptions<DashboardOptions>, ValidateDashboardOptions>(); 194builder.Services.AddSingleton<IPolicyEvaluator, AspirePolicyEvaluator>();
Aspire.Dashboard.Components.Tests (44)
Controls\ApplicationNameTests.cs (3)
23Services.AddSingleton<IDashboardClient, DashboardClient>(); 24Services.AddSingleton<IDashboardClientStatus, DashboardClientStatus>(); 41Services.AddSingleton<IDashboardClient, MockDashboardClient>();
Layout\MainLayoutTests.cs (6)
130Services.AddSingleton<IDialogService, DialogService>(); 131Services.AddSingleton<IDashboardClient, TestDashboardClient>(); 133Services.AddSingleton<IThemeResolver, TestThemeResolver>(); 135Services.AddSingleton<BrowserTimeProvider, TestTimeProvider>(); 138Services.AddSingleton<ITooltipService, TooltipService>(); 139Services.AddSingleton<IToastService, ToastService>();
Pages\ConsoleLogsTests.cs (6)
163Services.AddSingleton<BrowserTimeProvider, TestTimeProvider>(); 164Services.AddSingleton<IMessageService, MessageService>(); 167Services.AddSingleton<IDialogService, DialogService>(); 168Services.AddSingleton<ISessionStorage, TestSessionStorage>(); 169Services.AddSingleton<ILocalStorage, TestLocalStorage>(); 172Services.AddSingleton<IKeyCodeService, KeyCodeService>();
Pages\StructuredLogsTests.cs (6)
175Services.AddSingleton<BrowserTimeProvider, TestTimeProvider>(); 177Services.AddSingleton<IMessageService, MessageService>(); 181Services.AddSingleton<IDialogService, DialogService>(); 183Services.AddSingleton<ISessionStorage, TestSessionStorage>(); 184Services.AddSingleton<ILocalStorage, TestLocalStorage>(); 187Services.AddSingleton<IKeyCodeService, KeyCodeService>();
Pages\TraceDetailsTests.cs (6)
109Services.AddSingleton<BrowserTimeProvider, TestTimeProvider>(); 111Services.AddSingleton<IMessageService, MessageService>(); 115Services.AddSingleton<IDialogService, DialogService>(); 116Services.AddSingleton<ISessionStorage, TestSessionStorage>(); 117Services.AddSingleton<ILocalStorage, TestLocalStorage>(); 120Services.AddSingleton<IKeyCodeService, KeyCodeService>();
Shared\MetricsSetupHelpers.cs (9)
38context.Services.AddSingleton<IInstrumentUnitResolver, TestInstrumentUnitResolver>(); 39context.Services.AddSingleton<BrowserTimeProvider, TestTimeProvider>(); 41context.Services.AddSingleton<IDialogService, DialogService>(); 76context.Services.AddSingleton<IMessageService, MessageService>(); 79context.Services.AddSingleton<IDialogService, DialogService>(); 80context.Services.AddSingleton<BrowserTimeProvider, TestTimeProvider>(); 82context.Services.AddSingleton<ILocalStorage, TestLocalStorage>(); 85context.Services.AddSingleton<IKeyCodeService, KeyCodeService>(); 86context.Services.AddSingleton<IThemeResolver, TestThemeResolver>();
Shared\ResourceSetupHelpers.cs (4)
17context.Services.AddSingleton<IInstrumentUnitResolver, TestInstrumentUnitResolver>(); 18context.Services.AddSingleton<BrowserTimeProvider, TestTimeProvider>(); 20context.Services.AddSingleton<IDialogService, DialogService>(); 22context.Services.AddSingleton<IKeyCodeService, KeyCodeService>();
Shared\StructuredLogsSetupHelpers.cs (4)
17context.Services.AddSingleton<IInstrumentUnitResolver, TestInstrumentUnitResolver>(); 18context.Services.AddSingleton<BrowserTimeProvider, TestTimeProvider>(); 20context.Services.AddSingleton<IDialogService, DialogService>(); 22context.Services.AddSingleton<IKeyCodeService, KeyCodeService>();
Aspire.Dashboard.Tests (1)
Integration\Playwright\Infrastructure\DashboardServerFixture.cs (1)
60builder.Services.AddSingleton<IDashboardClientStatus, MockDashboardClientStatus>();
Aspire.Hosting (4)
Dashboard\DashboardServiceHost.cs (1)
82builder.Services.AddSingleton<IValidateOptions<ResourceServiceOptions>, ValidateResourceServiceOptions>();
DistributedApplicationBuilder.cs (2)
273_innerBuilder.Services.AddSingleton<IDashboardEndpointProvider, HostDashboardEndpointProvider>(); 281_innerBuilder.Services.AddSingleton<IDcpDependencyCheckService, DcpDependencyCheck>();
Lifecycle\LifecycleHookServiceCollectionExtensions.cs (1)
21services.AddSingleton<IDistributedApplicationLifecycleHook, T>();
Aspire.Hosting.Tests (6)
Dashboard\DashboardResourceTests.cs (6)
85builder.Services.AddSingleton<IDashboardEndpointProvider, MockDashboardEndpointProvider>(); 191builder.Services.AddSingleton<IDashboardEndpointProvider, MockDashboardEndpointProvider>(); 228builder.Services.AddSingleton<IDashboardEndpointProvider, MockDashboardEndpointProvider>(); 260builder.Services.AddSingleton<IDashboardEndpointProvider, MockDashboardEndpointProvider>(); 295builder.Services.AddSingleton<IDashboardEndpointProvider, MockDashboardEndpointProvider>(); 338builder.Services.AddSingleton<IDashboardEndpointProvider, MockDashboardEndpointProvider>();
BasicTestApp (1)
Program.cs (1)
35builder.Services.AddSingleton<AuthenticationStateProvider, ServerAuthenticationStateProvider>();
BasicWebSite (4)
Startup.cs (1)
23services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();
StartupWithoutEndpointRouting.cs (3)
43services.AddSingleton<IActionDescriptorProvider, ActionDescriptorCreationCounter>(); 48services.AddSingleton<ICustomService, DefaultCustomService>(); 52services.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)
26services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();
HostedBlazorWebassemblyApp.Server (1)
Startup.cs (1)
33services.AddSingleton<IWeatherForecastService, WeatherForecastService>();
http2cat (1)
src\Shared\Http2cat\Http2CatIServiceCollectionExtensions.cs (1)
15services.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>();
IIS.FunctionalTests (1)
src\Shared\Http2cat\Http2CatIServiceCollectionExtensions.cs (1)
15services.AddSingleton<IConnectionFactory, SocketConnectionFactory>();
IIS.LongTests (1)
src\Shared\Http2cat\Http2CatIServiceCollectionExtensions.cs (1)
15services.AddSingleton<IConnectionFactory, SocketConnectionFactory>();
IIS.NewHandler.FunctionalTests (1)
src\Shared\Http2cat\Http2CatIServiceCollectionExtensions.cs (1)
15services.AddSingleton<IConnectionFactory, SocketConnectionFactory>();
IIS.NewShim.FunctionalTests (1)
src\Shared\Http2cat\Http2CatIServiceCollectionExtensions.cs (1)
15services.AddSingleton<IConnectionFactory, SocketConnectionFactory>();
IISExpress.FunctionalTests (1)
src\Shared\Http2cat\Http2CatIServiceCollectionExtensions.cs (1)
15services.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)
src\Servers\IIS\IIS\test\testassets\InProcessWebSite\Program.cs (1)
99.ConfigureServices(services => services.AddSingleton<IServer, DummyServer>())
IStartupInjectionAssemblyName (1)
Program.cs (1)
23.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)
1803s.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)
1670services.AddSingleton<IJSRuntime, UnsupportedJavaScriptRuntime>(); 1671services.AddSingleton<NavigationManager, HttpNavigationManager>(); 1672services.AddSingleton<ILoggerFactory, NullLoggerFactory>(); 1673services.AddSingleton<ILogger<ComponentStatePersistenceManager>, NullLogger<ComponentStatePersistenceManager>>(); 1681services.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 (2)
Routing\RouterTest.cs (2)
25services.AddSingleton<INavigationInterception, TestNavigationInterception>(); 26services.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)
308Services.AddSingleton<AntiforgeryStateProvider, DefaultAntiforgeryStateProvider>(); 309Services.AddSingleton<IErrorBoundaryLogger, WebAssemblyErrorBoundaryLogger>();
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)
1293services.AddSingleton<IStartupFilter, MyStartupFilter>(); 1403services.AddSingleton<IServer, ServerMustBeStartedSecond>();
WebHostTests.cs (4)
377s.AddSingleton<IFakeSingletonService, FakeService>(); 527services.AddSingleton<IHostedService, TestHostedService>(); 1070services.AddSingleton<IHostedService, TestHostedService>(); 1457return builder.ConfigureServices(services => services.AddSingleton<IServer, WebHostTests.FakeServer>());
Microsoft.AspNetCore.Http.Connections.Tests (2)
HttpConnectionDispatcherTests.cs (2)
3510services.AddSingleton<IDataProtectionProvider, EphemeralDataProtectionProvider>(); 3660services.AddSingleton<IDataProtectionProvider, EphemeralDataProtectionProvider>();
Microsoft.AspNetCore.Http.Results.Tests (18)
BadRequestOfTResultTests.cs (1)
182services.AddSingleton<ILoggerFactory, NullLoggerFactory>();
BadRequestResultTests.cs (1)
95services.AddSingleton<ILoggerFactory, NullLoggerFactory>();
ConflictOfTResultTests.cs (1)
160services.AddSingleton<ILoggerFactory, NullLoggerFactory>();
ConflictResultTests.cs (1)
96services.AddSingleton<ILoggerFactory, NullLoggerFactory>();
CreatedAtRouteOfTResultTests.cs (1)
191services.AddSingleton<ILoggerFactory, NullLoggerFactory>();
CreatedAtRouteResultTests.cs (1)
137services.AddSingleton<ILoggerFactory, NullLoggerFactory>();
CreatedOfTResultTests.cs (1)
188services.AddSingleton<ILoggerFactory, NullLoggerFactory>();
CreatedResultTests.cs (1)
125services.AddSingleton<ILoggerFactory, NullLoggerFactory>();
FileContentResultTests.cs (1)
31.AddSingleton<ILoggerFactory, NullLoggerFactory>()
HttpResultsHelperTests.cs (1)
245services.AddSingleton<ILoggerFactory, NullLoggerFactory>();
InternalServerErrorOfTResultTests.cs (1)
182services.AddSingleton<ILoggerFactory, NullLoggerFactory>();
InternalServerErrorResultTests.cs (1)
95services.AddSingleton<ILoggerFactory, NullLoggerFactory>();
NotFoundOfTResultTests.cs (1)
151services.AddSingleton<ILoggerFactory, NullLoggerFactory>();
NotFoundResultTests.cs (1)
100services.AddSingleton<ILoggerFactory, NullLoggerFactory>();
OkOfTResultTests.cs (1)
159services.AddSingleton<ILoggerFactory, NullLoggerFactory>();
OkResultTests.cs (1)
94services.AddSingleton<ILoggerFactory, NullLoggerFactory>();
UnprocessableEntityOfTResultTests.cs (1)
159services.AddSingleton<ILoggerFactory, NullLoggerFactory>();
UnprocessableEntityResultTests.cs (1)
95services.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>(); 34.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.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)
15services.AddSingleton<IConnectionFactory, SocketConnectionFactory>();
Microsoft.AspNetCore.Server.IIS (2)
WebHostBuilderIISExtensions.cs (2)
38services.AddSingleton<IServer, IISHttpServer>(); 40services.AddSingleton<IStartupFilter, IISServerSetupFilter>();
Microsoft.AspNetCore.Server.Kestrel (3)
WebHostBuilderKestrelExtensions.cs (3)
40services.AddSingleton<HttpsConfigurationService.IInitializer, HttpsConfigurationService.Initializer>(); 88services.AddSingleton<IHttpsConfigurationService, HttpsConfigurationService>(); 89services.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.Server.Kestrel.Transport.Sockets (1)
WebHostBuilderSocketExtensions.cs (1)
28services.AddSingleton<IConnectionListenerFactory, SocketTransportFactory>();
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)
28services.AddSingleton<IHostLifetime, NoopHostLifetime>(); 29services.AddSingleton<IServer, TestServer>(); 44services.AddSingleton<IHostLifetime, NoopHostLifetime>(); 45services.AddSingleton<IServer, TestServer>();
Microsoft.AspNetCore.TestHost.Tests (3)
TestServerTests.cs (3)
125.ConfigureServices(s => s.AddSingleton<IServiceProviderFactory<ThirdPartyContainer>, ThirdPartyContainerServiceProviderFactory>()) 585services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>(); 616services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
Microsoft.AspNetCore.Tests (6)
WebApplicationTests.cs (6)
1497services.AddSingleton<IService, Service>(); 1554builder.Services.AddSingleton<IHostLifetime, CustomHostLifetime>(); 1666builder.Services.AddSingleton<IStartupFilter, TerminalMiddlewareStartupFilter>(); 1688builder.Services.AddSingleton<IStartupFilter, UseRoutingStartupFilter>(); 2015builder.Services.AddSingleton<IStartupFilter, PropertyFilter>(); 2051builder.Services.AddSingleton<IStartupFilter, ThrowingStartupFilter>();
Microsoft.DotNet.Build.Tasks.Feed.Tests (27)
BuildModelFactoryTests.cs (6)
53.AddSingleton<ISigningInformationModelFactory, SigningInformationModelFactory>() 54.AddSingleton<IBlobArtifactModelFactory, BlobArtifactModelFactory>() 55.AddSingleton<IPackageArtifactModelFactory, PackageArtifactModelFactory>() 56.AddSingleton<IPackageArchiveReaderFactory, PackageArchiveReaderFactory>() 57.AddSingleton<INupkgInfoFactory, NupkgInfoFactory>() 58.AddSingleton<IFileSystem, FileSystem>()
GenerateBuildManifestTests.cs (1)
63.AddSingleton<IBuildModelFactory, BuildModelFactory>();
PublishArtifactsInManifestTests.cs (2)
48.AddSingleton<IFileSystem, FileSystem>() 49.AddSingleton<IBuildModelFactory, BuildModelFactory>();
PushToBuildStorageTests.cs (18)
215.AddSingleton<IBuildModelFactory, BuildModelFactory>(); 246.AddSingleton<IBuildModelFactory, BuildModelFactory>(); 291.AddSingleton<IBuildModelFactory, BuildModelFactory>() 292.AddSingleton<IPackageArtifactModelFactory, PackageArtifactModelFactory>() 293.AddSingleton<IBlobArtifactModelFactory, BlobArtifactModelFactory>() 340.AddSingleton<IBuildModelFactory, BuildModelFactory>() 341.AddSingleton<IPackageArtifactModelFactory, PackageArtifactModelFactory>() 342.AddSingleton<IBlobArtifactModelFactory, BlobArtifactModelFactory>() 387.AddSingleton<IBuildModelFactory, BuildModelFactory>() 388.AddSingleton<IPackageArtifactModelFactory, PackageArtifactModelFactory>() 389.AddSingleton<IBlobArtifactModelFactory, BlobArtifactModelFactory>() 437.AddSingleton<IBuildModelFactory, BuildModelFactory>() 438.AddSingleton<IPackageArtifactModelFactory, PackageArtifactModelFactory>() 439.AddSingleton<IBlobArtifactModelFactory, BlobArtifactModelFactory>() 541.AddSingleton<IBuildModelFactory, BuildModelFactory>() 542.AddSingleton<IPackageArtifactModelFactory, PackageArtifactModelFactory>() 543.AddSingleton<IBlobArtifactModelFactory, BlobArtifactModelFactory>() 544.AddSingleton<ISigningInformationModelFactory, SigningInformationModelFactory>()
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)
113services => services.AddSingleton<IDistributedCache, TestCache>()); 174services => 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)
39builder.Services.AddSingleton<ISnapshotProvider, FakeProvider>(); 75builder.Services.AddSingleton<ISnapshotProvider, FakeProvider>(); 97builder.Services.AddSingleton<ISnapshotProvider, FakeProvider>(); 125builder.Services.AddSingleton<ISnapshotProvider, FakeProvider>(); 169builder.Services.AddSingleton<ISnapshotProvider, FakeProvider>(); 191builder.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)
347return hostBuilder.ConfigureServices(collection => collection.AddSingleton<IHostLifetime, ConsoleLifetime>()); 365collection.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.Telemetry.Abstractions (2)
Enrichment\EnrichmentServiceCollectionExtensions.cs (2)
25=> Throw.IfNull(services).AddSingleton<ILogEnricher, T>(); 46=> Throw.IfNull(services).AddSingleton<IStaticLogEnricher, T>();
Microsoft.Extensions.WebEncoders.Tests (2)
EncoderServiceCollectionExtensionsTests.cs (2)
68serviceCollection.AddSingleton<HtmlEncoder, HtmlTestEncoder>(); 69serviceCollection.AddSingleton<JavaScriptEncoder, JavaScriptTestEncoder>();
Microsoft.ML.AutoML (2)
AutoMLExperiment\AutoMLExperiment.cs (2)
131_serviceCollection.AddSingleton<IMonitor, TMonitor>(); 194_serviceCollection.AddSingleton<ITuner, TTuner>();
Mvc.RoutingWebSite (8)
Startup.cs (1)
32services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();
StartupForDynamic.cs (1)
21services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();
StartupForDynamicOrder.cs (1)
36services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();
StartupForEndpointFilters.cs (1)
20services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();
StartupForFallback.cs (1)
19services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();
StartupForGroups.cs (1)
20services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();
StartupForLinkGenerator.cs (1)
34services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();
StartupRoutingDifferentBranches.cs (1)
34services.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)
90services.AddSingleton<IHttpsConfigurationService, HttpsConfigurationService>(); 91services.AddSingleton<HttpsConfigurationService.IInitializer, HttpsConfigurationService.Initializer>(); 137services.AddSingleton<IHostApplicationLifetime, LifetimeNotImplemented>();
Sockets.FunctionalTests (3)
src\Servers\Kestrel\shared\test\TransportTestHelpers\TestServer.cs (3)
90services.AddSingleton<IHttpsConfigurationService, HttpsConfigurationService>(); 91services.AddSingleton<HttpsConfigurationService.IInitializer, HttpsConfigurationService.Initializer>(); 137services.AddSingleton<IHostApplicationLifetime, LifetimeNotImplemented>();
VersioningWebSite (1)
Startup.cs (1)
17services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();