227 references to AddSingleton
ApiExplorerWebSite (1)
Startup.cs (1)
32services.AddSingleton<ApiExplorerDataFilter>();
Aspire.Dashboard (1)
DashboardWebApplication.cs (1)
239builder.Services.AddSingleton<TelemetryRepository>();
Aspire.Dashboard.Components.Tests (28)
Controls\ApplicationNameTests.cs (1)
25Services.AddSingleton<BrowserTimeProvider>();
Controls\TextVisualizerDialogTests.cs (1)
150Services.AddSingleton<LibraryConfiguration>();
Layout\MainLayoutTests.cs (4)
129Services.AddSingleton<ThemeManager>(); 134Services.AddSingleton<ShortcutManager>(); 137Services.AddSingleton<LibraryConfiguration>(); 140Services.AddSingleton<GlobalState>();
Pages\ConsoleLogsTests.cs (3)
166Services.AddSingleton<DimensionManager>(); 170Services.AddSingleton<ShortcutManager>(); 171Services.AddSingleton<LibraryConfiguration>();
Pages\StructuredLogsTests.cs (5)
176Services.AddSingleton<TelemetryRepository>(); 179Services.AddSingleton<DimensionManager>(); 182Services.AddSingleton<StructuredLogsViewModel>(); 185Services.AddSingleton<ShortcutManager>(); 186Services.AddSingleton<LibraryConfiguration>();
Pages\TraceDetailsTests.cs (4)
110Services.AddSingleton<TelemetryRepository>(); 113Services.AddSingleton<DimensionManager>(); 118Services.AddSingleton<ShortcutManager>(); 119Services.AddSingleton<LibraryConfiguration>();
Shared\MetricsSetupHelpers.cs (6)
40context.Services.AddSingleton<TelemetryRepository>(); 75context.Services.AddSingleton<TelemetryRepository>(); 78context.Services.AddSingleton<DimensionManager>(); 83context.Services.AddSingleton<ShortcutManager>(); 84context.Services.AddSingleton<LibraryConfiguration>(); 87context.Services.AddSingleton<ThemeManager>();
Shared\ResourceSetupHelpers.cs (2)
19context.Services.AddSingleton<TelemetryRepository>(); 21context.Services.AddSingleton<LibraryConfiguration>();
Shared\StructuredLogsSetupHelpers.cs (2)
19context.Services.AddSingleton<TelemetryRepository>(); 21context.Services.AddSingleton<LibraryConfiguration>();
Aspire.Hosting (9)
Dashboard\DashboardServiceHost.cs (1)
112builder.Services.AddSingleton<DashboardServiceData>();
DistributedApplicationBuilder.cs (8)
205_innerBuilder.Services.AddSingleton<ResourceNotificationService>(); 206_innerBuilder.Services.AddSingleton<ResourceLoggerService>(); 268_innerBuilder.Services.AddSingleton<DashboardCommandExecutor>(); 271_innerBuilder.Services.AddSingleton<DashboardServiceHost>(); 280_innerBuilder.Services.AddSingleton<ApplicationExecutor>(); 285_innerBuilder.Services.AddSingleton<DcpNameGenerator>(); 293_innerBuilder.Services.AddSingleton<CodespacesUrlRewriter>(); 360_innerBuilder.Services.AddSingleton<ResourceHealthCheckService>();
Aspire.RabbitMQ.Client (1)
AspireRabbitMQExtensions.cs (1)
123builder.Services.AddSingleton<RabbitMQEventSourceLogForwarder>();
Aspire.RabbitMQ.Client.Tests (2)
AspireRabbitMQLoggingTests.cs (2)
75builder.Services.AddSingleton<RabbitMQEventSourceLogForwarder>(); 104builder.Services.AddSingleton<RabbitMQEventSourceLogForwarder>();
BasicWebSite (3)
StartupWithCustomInvalidModelStateFactory.cs (1)
36services.AddSingleton<ContactsRepository>();
StartupWithoutEndpointRouting.cs (1)
45services.AddSingleton<ContactsRepository>();
StartupWithSystemTextJson.cs (1)
13services.AddSingleton<ContactsRepository>();
BlazorServerApp (1)
Startup.cs (1)
23services.AddSingleton<WeatherForecastService>();
BlazorUnitedApp (1)
Program.cs (1)
14builder.Services.AddSingleton<WeatherForecastService>();
CatalogDb (1)
Program.cs (1)
11builder.Services.AddSingleton<CatalogDbInitializer>();
HtmlGenerationWebSite (1)
Startup.cs (1)
21services.AddSingleton<ProductsService>();
Microsoft.AspNetCore.Authentication.Test (2)
WsFederation\WsFederationTest.cs (1)
208services.AddSingleton<MyWsFedEvents>();
WsFederation\WsFederationTest_Handler.cs (1)
206services.AddSingleton<MyWsFedEvents>();
Microsoft.AspNetCore.Components.Endpoints.Tests (9)
EndpointHtmlRendererTest.cs (4)
1674services.AddSingleton<ComponentStatePersistenceManager>(); 1676services.AddSingleton<ServerComponentSerializer>(); 1677services.AddSingleton<HttpContextFormDataProvider>(); 1679services.AddSingleton<ComponentStatePersistenceManager>();
RazorComponentResultTest.cs (5)
459.AddSingleton<EndpointHtmlRenderer>() 462.AddSingleton<ServerComponentSerializer>() 463.AddSingleton<ComponentStatePersistenceManager>() 465.AddSingleton<HttpContextFormDataProvider>() 466.AddSingleton<ComponentStatePersistenceManager>()
Microsoft.AspNetCore.Components.Tests (1)
OwningComponentBaseTest.cs (1)
15services.AddSingleton<Counter>();
Microsoft.AspNetCore.Components.Web.Tests (3)
Forms\EditFormTest.cs (1)
23services.AddSingleton<ComponentStatePersistenceManager>();
HtmlRendering\HtmlRendererTest.cs (2)
757var serviceProvider = GetServiceProvider(collection => collection.AddSingleton<AsyncComponent>()); 783var serviceProvider = GetServiceProvider(collection => collection.AddSingleton<AsyncComponent>());
Microsoft.AspNetCore.Components.WebAssembly (2)
Hosting\WebAssemblyHostBuilder.cs (2)
306Services.AddSingleton<ComponentStatePersistenceManager>(); 310Services.AddSingleton<ResourceCollectionProvider>();
Microsoft.AspNetCore.Components.WebAssembly.Tests (3)
Hosting\WebAssemblyHostBuilderTest.cs (2)
99builder.Services.AddSingleton<TestServiceThatTakesStringBuilder>(); 116builder.Services.AddSingleton<TestServiceThatTakesStringBuilder>();
Hosting\WebAssemblyHostTest.cs (1)
65builder.Services.AddSingleton<DisposableService>();
Microsoft.AspNetCore.Components.WebView.Test (1)
WebViewManagerTests.cs (1)
115return new ServiceCollection().AddSingleton<SingletonService>().AddScoped<ScopedService>();
Microsoft.AspNetCore.Components.WebViewE2E.Test (1)
BasicBlazorHybridTest.cs (1)
42serviceCollection.AddSingleton<HttpClient>();
Microsoft.AspNetCore.Diagnostics.Middleware.Tests (1)
Logging\AcceptanceTests.cs (1)
118x.AddSingleton<FakeTimeProvider>();
Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests (1)
Infrastructure\TestHelpers.cs (1)
23serviceCollection.AddSingleton<JsonTranscodingGreeterService>();
Microsoft.AspNetCore.HeaderParsing (1)
HeaderParsingServiceCollectionExtensions.cs (1)
34.AddSingleton<HeaderParsingMetrics>()
Microsoft.AspNetCore.Hosting (2)
Internal\WebHost.cs (2)
64_applicationServiceCollection.AddSingleton<ApplicationLifetime>(); 74_applicationServiceCollection.AddSingleton<HostedServiceExecutor>();
Microsoft.AspNetCore.Hosting.Tests (4)
ConfigureBuilderTests.cs (1)
19.AddSingleton<CrasherService>()
StartupManagerTests.cs (1)
734services.AddSingleton<SimpleService>();
WebHostBuilderTests.cs (2)
1401services.AddSingleton<StartOrder>(); 1692.ConfigureServices(services => services.AddSingleton<ServiceA>())
Microsoft.AspNetCore.Http.Connections.Tests (65)
HttpConnectionDispatcherTests.cs (65)
63services.AddSingleton<TestConnectionHandler>(); 87services.AddSingleton<TestConnectionHandler>(); 113services.AddSingleton<TestConnectionHandler>(); 150services.AddSingleton<TestConnectionHandler>(); 178services.AddSingleton<TestConnectionHandler>(); 224services.AddSingleton<TestConnectionHandler>(); 265services.AddSingleton<TestConnectionHandler>(); 304services.AddSingleton<TestConnectionHandler>(); 346services.AddSingleton<TestConnectionHandler>(); 384services.AddSingleton<TestConnectionHandler>(); 423services.AddSingleton<TestConnectionHandler>(); 463services.AddSingleton<TestConnectionHandler>(); 526services.AddSingleton<TestConnectionHandler>(); 594services.AddSingleton<TestConnectionHandler>(); 657services.AddSingleton<TestConnectionHandler>(); 720services.AddSingleton<TestConnectionHandler>(); 759services.AddSingleton<HttpContextConnectionHandler>(); 857services.AddSingleton<TestConnectionHandler>(); 903services.AddSingleton<TestConnectionHandler>(); 933services.AddSingleton<TestConnectionHandler>(); 1007services.AddSingleton<ImmediatelyCompleteConnectionHandler>(); 1040services.AddSingleton<SynchronusExceptionConnectionHandler>(); 1068services.AddSingleton<ImmediatelyCompleteConnectionHandler>(); 1104services.AddSingleton<ImmediatelyCompleteConnectionHandler>(); 1140services.AddSingleton<ImmediatelyCompleteConnectionHandler>(); 1191services.AddSingleton<TestConnectionHandler>(); 1286services.AddSingleton<TestConnectionHandler>(); 1326services.AddSingleton<TestConnectionHandler>(); 1371services.AddSingleton<TestConnectionHandler>(); 1411services.AddSingleton<ImmediatelyCompleteConnectionHandler>(); 1440services.AddSingleton<TestConnectionHandler>(); 1486services.AddSingleton<TestConnectionHandler>(); 1551services.AddSingleton<TestConnectionHandler>(); 1615services.AddSingleton<TestConnectionHandler>(); 1646services.AddSingleton<TestConnectionHandler>(); 1680services.AddSingleton<BlockingConnectionHandler>(); 1715services.AddSingleton<BlockingConnectionHandler>(); 1757services.AddSingleton<TestConnectionHandler>(); 1803services.AddSingleton<ImmediatelyCompleteConnectionHandler>(); 1836services.AddSingleton<TestConnectionHandler>(); 1888services.AddSingleton<TestConnectionHandler>(); 1942services.AddSingleton<TestConnectionHandler>(); 1988services.AddSingleton<TestConnectionHandler>(); 2020serviceCollection.AddSingleton<TestConnectionHandler>(); 2061services.AddSingleton<TestConnectionHandler>(); 2114services.AddSingleton<TestConnectionHandler>(); 2167services.AddSingleton<NeverEndingConnectionHandler>(); 2267services.AddSingleton<TestConnectionHandler>(); 2293services.AddSingleton<TestConnectionHandler>(); 2322services.AddSingleton<TestConnectionHandler>(); 2351services.AddSingleton<TestConnectionHandler>(); 2555services.AddSingleton<TestConnectionHandler>(); 2617services.AddSingleton<TestConnectionHandler>(); 2674services.AddSingleton<TestConnectionHandler>(); 2733services.AddSingleton<TestConnectionHandler>(); 2773services.AddSingleton<NeverEndingConnectionHandler>(); 2822services.AddSingleton<NeverEndingConnectionHandler>(); 2849services.AddSingleton<NeverEndingConnectionHandler>(); 2879services.AddSingleton<TestConnectionHandler>(); 2926services.AddSingleton<NeverEndingConnectionHandler>(); 2962services.AddSingleton<ServiceProviderConnectionHandler>(); 3013services.AddSingleton<ServiceProviderConnectionHandler>(); 3068services.AddSingleton<ServiceProviderConnectionHandler>(); 3113services.AddSingleton<NeverEndingConnectionHandler>(); 3695services.AddSingleton<ImmediatelyCompleteConnectionHandler>();
Microsoft.AspNetCore.Http.Extensions.Tests (1)
RequestDelegateGenerator\RequestDelegateCreationTests.cs (1)
613var serviceProvider = CreateServiceProvider((serviceCollection) => serviceCollection.AddSingleton<global::Http.ExampleService>());
Microsoft.AspNetCore.HttpLogging (2)
HttpLoggingServicesExtensions.cs (2)
70services.AddSingleton<W3CLoggerProcessor>(); 71services.AddSingleton<W3CLogger>();
Microsoft.AspNetCore.Mvc.Core.Test (2)
FileResultHelperTest.cs (2)
80.AddSingleton<EmptyFileResultExecutor>() 463services.AddSingleton<EmptyFileResultExecutor>();
Microsoft.AspNetCore.Mvc.FunctionalTests (2)
AsyncDisposalTest.cs (1)
34.ConfigureServices(s => s.AddSingleton<ControllerTestDisposeAsync>());
PageAsyncDisposalTest.cs (1)
20.ConfigureServices(s => s.AddSingleton<RazorPagesWebSite.PageTestDisposeAsync>());
Microsoft.AspNetCore.Mvc.Razor.Test (1)
RazorHotReloadTest.cs (1)
79.AddSingleton<RazorHotReload>()
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (2)
ViewComponentResultTest.cs (2)
153services.AddSingleton<IViewComponentSelector>(); 663services.AddSingleton<ViewComponentInvokerCache>();
Microsoft.AspNetCore.OpenApi.Tests (9)
Transformers\DocumentTransformerTests.cs (2)
76var serviceCollection = new ServiceCollection().AddSingleton<Dependency>(); 166var serviceCollection = new ServiceCollection().AddSingleton<Dependency>();
Transformers\OperationTransformerTests.cs (2)
272var serviceCollection = new ServiceCollection().AddSingleton<Dependency>(); 404var serviceCollection = new ServiceCollection().AddSingleton<Dependency>();
Transformers\SchemaTransformerTests.cs (2)
282var serviceCollection = new ServiceCollection().AddSingleton<Dependency>(); 761var serviceCollection = new ServiceCollection().AddSingleton<Dependency>();
Transformers\TypeBasedTransformerLifetimeTests.cs (3)
36var serviceCollection = new ServiceCollection().AddSingleton<Dependency>(); 135var serviceCollection = new ServiceCollection().AddSingleton<Dependency>(); 255var serviceCollection = new ServiceCollection().AddSingleton<Dependency>();
Microsoft.AspNetCore.RateLimiting (1)
RateLimiterServiceCollectionExtensions.cs (1)
40services.AddSingleton<RateLimitingMetrics>();
Microsoft.AspNetCore.Routing.Tests (8)
Builder\RouteHandlerEndpointRouteBuilderExtensionsTest.cs (6)
263var builder = new DefaultEndpointRouteBuilder(new ApplicationBuilder(new ServiceCollection().AddSingleton<TodoService>().BuildServiceProvider())); 283var builder = new DefaultEndpointRouteBuilder(new ApplicationBuilder(new ServiceCollection().AddSingleton<TodoService>().BuildServiceProvider())); 303var builder = new DefaultEndpointRouteBuilder(new ApplicationBuilder(new ServiceCollection().AddSingleton<TodoService>().BuildServiceProvider())); 327var builder = new DefaultEndpointRouteBuilder(new ApplicationBuilder(new ServiceCollection().AddSingleton<TodoService>().BuildServiceProvider())); 347var builder = new DefaultEndpointRouteBuilder(new ApplicationBuilder(new ServiceCollection().AddSingleton<TodoService>().BuildServiceProvider())); 367var builder = new DefaultEndpointRouteBuilder(new ApplicationBuilder(new ServiceCollection().AddSingleton<TodoService>().BuildServiceProvider()));
RouteTest.cs (1)
1762services.AddSingleton<RoutingMarkerService>();
TemplateParserDefaultValuesTests.cs (1)
130services.AddSingleton<RoutingMarkerService>();
Microsoft.AspNetCore.Server.HttpSys (1)
WebHostBuilderHttpSysExtensions.cs (1)
31services.AddSingleton<MessagePump>();
Microsoft.AspNetCore.Server.Kestrel (1)
WebHostBuilderKestrelExtensions.cs (1)
90services.AddSingleton<KestrelMetrics>();
Microsoft.AspNetCore.SignalR.Client.Core (1)
HubConnectionBuilder.cs (1)
30Services.AddSingleton<HubConnection>();
Microsoft.AspNetCore.SignalR.Tests (17)
HubConnectionHandlerTests.cs (16)
4671provider.AddSingleton<Service1>(); 4688provider.AddSingleton<Service1>(); 4689provider.AddSingleton<Service2>(); 4690provider.AddSingleton<Service3>(); 4707provider.AddSingleton<Service1>(); 4708provider.AddSingleton<Service2>(); 4709provider.AddSingleton<Service3>(); 4756provider.AddSingleton<Service1>(); 4777provider.AddSingleton<Service1>(); 4798provider.AddSingleton<Service1>(); 4823provider.AddSingleton<Service1>(); 4845provider.AddSingleton<Service1>(); 4846provider.AddSingleton<Service2>(); 4867provider.AddSingleton<Service1>(); 4868provider.AddSingleton<Service2>(); 5071provider.AddSingleton<Service1>();
HubFilterTests.cs (1)
584services.AddSingleton<CounterFilter>();
Microsoft.AspNetCore.SpaProxy (1)
SpaHostingStartup.cs (1)
27services.AddSingleton<SpaProxyLaunchManager>();
Microsoft.AspNetCore.TestHost.Tests (2)
TestServerTests.cs (2)
617services.AddSingleton<ContextHolder>(); 894services.AddSingleton<SimpleService>();
Microsoft.AspNetCore.Tests (2)
WebApplicationTests.cs (2)
1790builder.Services.AddSingleton<Service2>(); 1804builder.Services.AddSingleton<Service2>();
Microsoft.Extensions.DependencyInjection.AutoActivation (1)
AutoActivationExtensions.cs (1)
158.AddSingleton<TService>()
Microsoft.Extensions.Diagnostics.HealthChecks.Common (4)
CommonHealthChecksExtensions.Manual.cs (1)
57.AddSingleton<ManualHealthCheckTracker>()
CommonHealthChecksExtensions.TelemetryPublisher.cs (3)
23.AddSingleton<HealthCheckMetrics>() 37.AddSingleton<HealthCheckMetrics>() 51.AddSingleton<HealthCheckMetrics>()
Microsoft.Extensions.Diagnostics.HealthChecks.Tests (1)
DefaultHealthCheckServiceTest.cs (1)
467b.Services.AddSingleton<AnotherService>();
Microsoft.Extensions.Diagnostics.Testing (2)
Logging\FakeLoggerBuilderExtensions.cs (2)
32_ = builder.Services.AddSingleton<FakeLogCollector>(); 50_ = builder.Services.AddSingleton<FakeLogCollector>();
Microsoft.Extensions.Hosting.Testing.Tests (4)
FakeHostBuilderTests.cs (4)
132.AddSingleton<OuterClass>(); 150.AddSingleton<OuterClass>(); 164services.AddSingleton<DependentClass>(); 181services.AddSingleton<DependentClass>();
Microsoft.Extensions.ML (1)
ServiceCollectionExtensions.cs (1)
32services.AddSingleton<PredictionEnginePool<TData, TPrediction>>());
Microsoft.Extensions.ObjectPool.DependencyInjection.Tests (8)
DependencyInjectionExtensionsTests.cs (8)
99.AddSingleton<TestDependency>() 129.AddSingleton<TestDependency>() 143.AddSingleton<TestDependency>() 159.AddSingleton<TestDependency>() 178.AddSingleton<TestDependency>() 224.AddSingleton<TestDependency>() 259.AddSingleton<TestDependency>() 316.AddSingleton<TestDependency>()
Mvc.RoutingWebSite (1)
StartupRoutingDifferentBranches.cs (1)
35services.AddSingleton<BranchesTransformer>();
MyFrontend (1)
Program.cs (1)
15builder.Services.AddSingleton<BasketServiceClient>()
PhotinoTestApp (1)
Program.cs (1)
18serviceCollection.AddSingleton<HttpClient>();
RoutingSandbox (1)
UseEndpointRoutingStartup.cs (1)
20services.AddSingleton<FrameworkEndpointDataSource>();
SocialWeather (3)
Startup.cs (3)
17services.AddSingleton<PipeWeatherStreamFormatter>(); 18services.AddSingleton<ProtobufWeatherStreamFormatter>(); 19services.AddSingleton<FormatterResolver>();
Stress.ApiService (1)
Program.cs (1)
19builder.Services.AddSingleton<TestMetrics>();