Implemented interface member:
property
Services
Microsoft.Extensions.Hosting.IHostApplicationBuilder.Services
458 references to Services
aspire (128)
Program.cs (128)
182builder.Services.AddSingleton(new TelemetryManager(builder.Configuration, args)); 195builder.Services.AddSingleton(fileLoggerProvider); // Register for direct access to LogFilePath 196builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<ILoggerProvider>(fileLoggerProvider)); 204builder.Services.AddSingleton<ILoggerProvider>(sp => 226builder.Services.AddSingleton(sp => 231builder.Services.AddSingleton(s => new ConsoleEnvironment( 234builder.Services.AddSingleton(s => s.GetRequiredService<ConsoleEnvironment>().Out); 235builder.Services.AddSingleton<ICliHostEnvironment>(provider => 240builder.Services.AddSingleton(TimeProvider.System); 242builder.Services.AddSingleton<IProjectLocator, ProjectLocator>(); 243builder.Services.AddSingleton<ISolutionLocator, SolutionLocator>(); 244builder.Services.AddSingleton<ILanguageService, LanguageService>(); 245builder.Services.AddSingleton<IScaffoldingService, ScaffoldingService>(); 246builder.Services.AddSingleton<FallbackProjectParser>(); 247builder.Services.AddSingleton<IProjectUpdater, ProjectUpdater>(); 248builder.Services.AddSingleton<INewCommandPrompter, NewCommandPrompter>(); 249builder.Services.AddSingleton<IAddCommandPrompter, AddCommandPrompter>(); 250builder.Services.AddSingleton<IPublishCommandPrompter, PublishCommandPrompter>(); 251builder.Services.AddSingleton<ICertificateService, CertificateService>(); 252builder.Services.AddSingleton(BuildConfigurationService); 253builder.Services.AddSingleton<IFeatures, Features>(); 254builder.Services.AddTelemetryServices(); 255builder.Services.AddTransient<IDotNetCliExecutionFactory, DotNetCliExecutionFactory>(); 258builder.Services.AddSingleton(sp => CertificateManager.Create(sp.GetRequiredService<ILogger<NativeCertificateToolRunner>>())); 259builder.Services.AddSingleton<ICertificateToolRunner, NativeCertificateToolRunner>(); 261builder.Services.AddTransient<IDotNetCliRunner, DotNetCliRunner>(); 262builder.Services.AddSingleton<IDiskCache, DiskCache>(); 263builder.Services.AddSingleton<IDotNetSdkInstaller, DotNetSdkInstaller>(); 264builder.Services.AddTransient<IAppHostCliBackchannel, AppHostCliBackchannel>(); 267builder.Services.AddSingleton<NuGetPackageCache>(); 268builder.Services.AddSingleton<BundleNuGetPackageCache>(); 269builder.Services.AddSingleton<INuGetPackageCache>(sp => 280builder.Services.AddSingleton<NuGetPackagePrefetcher>(); 281builder.Services.AddHostedService(sp => sp.GetRequiredService<NuGetPackagePrefetcher>()); 282builder.Services.AddSingleton<AuxiliaryBackchannelMonitor>(); 283builder.Services.AddSingleton<IAuxiliaryBackchannelMonitor>(sp => sp.GetRequiredService<AuxiliaryBackchannelMonitor>()); 284builder.Services.AddHostedService(sp => sp.GetRequiredService<AuxiliaryBackchannelMonitor>()); 285builder.Services.AddSingleton<ICliUpdateNotifier, CliUpdateNotifier>(); 286builder.Services.AddSingleton<IPackagingService, PackagingService>(); 287builder.Services.AddSingleton<IBundleService, BundleService>(); 288builder.Services.AddSingleton<IAppHostServerProjectFactory, AppHostServerProjectFactory>(); 289builder.Services.AddSingleton<ICliDownloader, CliDownloader>(); 290builder.Services.AddSingleton<IFirstTimeUseNoticeSentinel>(_ => new FirstTimeUseNoticeSentinel(GetUsersAspirePath())); 291builder.Services.AddSingleton<IBannerService, BannerService>(); 292builder.Services.AddMemoryCache(); 295builder.Services.AddSingleton<IDocsCache, DocsCache>(); 296builder.Services.AddHttpClient<IDocsFetcher, DocsFetcher>(); 297builder.Services.AddSingleton<IDocsIndexService, DocsIndexService>(); 298builder.Services.AddSingleton<IDocsSearchService, DocsSearchService>(); 302builder.Services.AddSingleton<ILayoutDiscovery, LayoutDiscovery>(); 303builder.Services.AddSingleton<BundleNuGetService>(); 306builder.Services.AddSingleton<IGitRepository, GitRepository>(); 309builder.Services.AddSingleton<IOpenCodeCliRunner, OpenCodeCliRunner>(); 312builder.Services.AddSingleton<IClaudeCodeCliRunner, ClaudeCodeCliRunner>(); 315builder.Services.AddSingleton<IVsCodeCliRunner, VsCodeCliRunner>(); 316builder.Services.AddSingleton<ICopilotCliRunner, CopilotCliRunner>(); 319builder.Services.AddSingleton<IAgentEnvironmentDetector, AgentEnvironmentDetector>(); 320builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IAgentEnvironmentScanner, VsCodeAgentEnvironmentScanner>()); 321builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IAgentEnvironmentScanner, CopilotCliAgentEnvironmentScanner>()); 322builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IAgentEnvironmentScanner, OpenCodeAgentEnvironmentScanner>()); 323builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IAgentEnvironmentScanner, ClaudeCodeAgentEnvironmentScanner>()); 324builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IAgentEnvironmentScanner, DeprecatedMcpCommandScanner>()); 327builder.Services.AddSingleton<ITemplateProvider, TemplateProvider>(); 328builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<ITemplateFactory, DotNetTemplateFactory>()); 331builder.Services.AddSingleton<ILanguageDiscovery, DefaultLanguageDiscovery>(); 334builder.Services.AddSingleton<IAppHostServerSessionFactory, AppHostServerSessionFactory>(); 337builder.Services.AddSingleton<DotNetAppHostProject>(); 338builder.Services.AddSingleton<Func<LanguageInfo, GuestAppHostProject>>(sp => 342builder.Services.AddSingleton<IAppHostProjectFactory, AppHostProjectFactory>(); 345builder.Services.AddSingleton<IEnvironmentCheck, WslEnvironmentCheck>(); 346builder.Services.AddSingleton<IEnvironmentCheck, DotNetSdkCheck>(); 347builder.Services.AddSingleton<IEnvironmentCheck, DeprecatedWorkloadCheck>(); 348builder.Services.AddSingleton<IEnvironmentCheck, DevCertsCheck>(); 349builder.Services.AddSingleton<IEnvironmentCheck, ContainerRuntimeCheck>(); 350builder.Services.AddSingleton<IEnvironmentCheck, DeprecatedAgentConfigCheck>(); 351builder.Services.AddSingleton<IEnvironmentChecker, EnvironmentChecker>(); 355builder.Services.AddSingleton<IMcpTransportFactory, StdioMcpTransportFactory>(); 358builder.Services.AddTransient<AppHostLauncher>(); 359builder.Services.AddTransient<NewCommand>(); 360builder.Services.AddTransient<InitCommand>(); 361builder.Services.AddTransient<RunCommand>(); 362builder.Services.AddTransient<StopCommand>(); 363builder.Services.AddTransient<StartCommand>(); 364builder.Services.AddTransient<RestartCommand>(); 365builder.Services.AddTransient<WaitCommand>(); 366builder.Services.AddTransient<ResourceCommand>(); 367builder.Services.AddTransient<PsCommand>(); 368builder.Services.AddTransient<DescribeCommand>(); 369builder.Services.AddTransient<LogsCommand>(); 370builder.Services.AddTransient<AddCommand>(); 371builder.Services.AddTransient<PublishCommand>(); 372builder.Services.AddTransient<ConfigCommand>(); 373builder.Services.AddTransient<CacheCommand>(); 374builder.Services.AddTransient<DoctorCommand>(); 375builder.Services.AddTransient<UpdateCommand>(); 376builder.Services.AddTransient<DeployCommand>(); 377builder.Services.AddTransient<DoCommand>(); 378builder.Services.AddTransient<ExecCommand>(); 379builder.Services.AddTransient<McpCommand>(); 380builder.Services.AddTransient<McpStartCommand>(); 381builder.Services.AddTransient<McpInitCommand>(); 382builder.Services.AddTransient<AgentCommand>(); 383builder.Services.AddTransient<AgentMcpCommand>(); 384builder.Services.AddTransient<AgentInitCommand>(); 385builder.Services.AddTransient<TelemetryCommand>(); 386builder.Services.AddTransient<TelemetryLogsCommand>(); 387builder.Services.AddTransient<TelemetrySpansCommand>(); 388builder.Services.AddTransient<TelemetryTracesCommand>(); 389builder.Services.AddTransient<DocsCommand>(); 390builder.Services.AddTransient<DocsListCommand>(); 391builder.Services.AddTransient<DocsSearchCommand>(); 392builder.Services.AddTransient<DocsGetCommand>(); 393builder.Services.AddTransient<SecretCommand>(); 394builder.Services.AddTransient<SecretSetCommand>(); 395builder.Services.AddTransient<SecretGetCommand>(); 396builder.Services.AddTransient<SecretListCommand>(); 397builder.Services.AddTransient<SecretDeleteCommand>(); 398builder.Services.AddTransient<SecretStoreResolver>(); 399builder.Services.AddTransient<SdkCommand>(); 400builder.Services.AddTransient<SdkGenerateCommand>(); 401builder.Services.AddTransient<SdkDumpCommand>(); 402builder.Services.AddTransient<SetupCommand>(); 403builder.Services.AddTransient<RootCommand>(); 404builder.Services.AddTransient<ExtensionInternalCommand>(); 686builder.Services.AddSingleton<IExtensionRpcTarget, ExtensionRpcTarget>(); 687builder.Services.AddSingleton<IExtensionBackchannel, ExtensionBackchannel>(); 690builder.Services.AddSingleton<IInteractionService>(provider => 704builder.Services.AddSingleton<IInteractionService>(provider =>
Aspire.Azure.Messaging.EventHubs.Tests (10)
AspireEventHubsExtensionsTests.cs (10)
80ConfigureBlobServiceClient(useKeyed, builder.Services); 127ConfigureBlobServiceClient(useKeyed, builder.Services); 196ConfigureBlobServiceClient(useKeyed, builder.Services); 258ConfigureBlobServiceClient(useKeyed, builder.Services); 324ConfigureBlobServiceClient(useKeyed, builder.Services); 370ConfigureBlobServiceClient(useKeyed, builder.Services); 418ConfigureBlobServiceClient(useKeyed, builder.Services); 500ConfigureBlobServiceClient(useKeyed, builder.Services); 561ConfigureBlobServiceClient(useKeyed: false, builder.Services); 618builder.Services.AddSingleton(blobClient);
Aspire.Azure.Npgsql.EntityFrameworkCore.PostgreSQL.Tests (26)
AspireAzureEFPostgreSqlExtensionsTests.cs (4)
275builder.Services.AddDbContextPool<ITestDbContext, TestDbContext>(options => options.UseNpgsql(ConnectionString)); 279builder.Services.AddDbContextPool<TestDbContext>(options => options.UseNpgsql(ConnectionString)); 298builder.Services.AddDbContextPool<ITestDbContext, TestDbContext>(options => options.UseNpgsql(ConnectionString)); 302builder.Services.AddDbContextPool<TestDbContext>(options => options.UseNpgsql(ConnectionString));
EnrichNpgsqlTests.cs (18)
28builder.Services.AddDbContextPool<TestDbContext>(options => options.UseNpgsql(ConnectionString)); 46builder.Services.AddDbContext<TestDbContext>(options => options.UseNpgsql(ConnectionString)); 64builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 100builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 121builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 127var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 157builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 166var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 172var optionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 204builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 213var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 240builder.Services.AddDbContextPool<ITestDbContext, TestDbContext>(optionsBuilder => 258builder.Services.AddDbContext<ITestDbContext, TestDbContext>(optionsBuilder => 266var optionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 280builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 309builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 327builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 360builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder =>
TokenCredentialTests.cs (4)
43builder.Services.AddDbContextPool<TestDbContext>(options => options.UseNpgsql(connectionString)); 74builder.Services.AddDbContextPool<TestDbContext>(options => options.UseNpgsql(connectionString)); 106builder.Services.AddDbContextPool<TestDbContext>(options => options.UseNpgsql(connectionString)); 138builder.Services.AddDbContextPool<TestDbContext>(options => options.UseNpgsql(connectionString));
Aspire.Components.Common.TestUtilities (3)
ConformanceTests.cs (3)
303builder.Services.AddSingleton<ILoggerFactory, TestLoggerFactory>(); 310builder.Services.AddSingleton<ILoggerFactory, TestLoggerFactory>(); 500builder.Services.AddOpenTelemetry().WithTracing(builder => builder.AddInMemoryExporter(exportedActivities));
Aspire.Confluent.Kafka.Tests (2)
OtelMetricsTests.cs (1)
61builder.Services.AddOpenTelemetry().WithMetrics(meterProvider => meterProvider.AddInMemoryExporter(metrics));
OtelTracesTests.cs (1)
63builder.Services.AddOpenTelemetry().WithTracing(traceProviderBuilder => traceProviderBuilder.AddInMemoryExporter(activities));
Aspire.Hosting (84)
DistributedApplicationBuilder.cs (83)
80public IServiceCollection Services => _innerBuilder.Services; 204_innerBuilder.Services.AddSingleton(TimeProvider.System); 206_innerBuilder.Services.AddSingleton<BackchannelLoggerProvider>(); 207_innerBuilder.Services.AddSingleton<ILoggerProvider>(sp => sp.GetRequiredService<BackchannelLoggerProvider>()); 321_innerBuilder.Services.AddSingleton<ExecResourceManager>(); 328_innerBuilder.Services.AddSingleton<IFileSystemService>(sp => 342_innerBuilder.Services.AddSingleton(_userSecretsManager); 344_innerBuilder.Services.AddSingleton(sp => new DistributedApplicationModel(Resources)); 345_innerBuilder.Services.AddSingleton<PipelineExecutor>(); 346_innerBuilder.Services.AddHostedService<PipelineExecutor>(sp => sp.GetRequiredService<PipelineExecutor>()); 347_innerBuilder.Services.AddHostedService<DistributedApplicationLifecycle>(); 348_innerBuilder.Services.AddHostedService<VersionCheckService>(); 349_innerBuilder.Services.AddSingleton<IPackageFetcher, PackageFetcher>(); 350_innerBuilder.Services.AddSingleton<IPackageVersionProvider, PackageVersionProvider>(); 351_innerBuilder.Services.AddSingleton(options); 352_innerBuilder.Services.AddSingleton<ResourceNotificationService>(); 353_innerBuilder.Services.AddSingleton<ResourceLoggerService>(); 354_innerBuilder.Services.AddSingleton<ResourceCommandService>(s => new ResourceCommandService(s.GetRequiredService<ResourceNotificationService>(), s.GetRequiredService<ResourceLoggerService>(), s)); 356_innerBuilder.Services.AddSingleton<InteractionService>(); 357_innerBuilder.Services.AddSingleton<IInteractionService>(sp => sp.GetRequiredService<InteractionService>()); 358_innerBuilder.Services.AddSingleton<ParameterProcessor>(); 360_innerBuilder.Services.AddSingleton<IDistributedApplicationEventing>(Eventing); 361_innerBuilder.Services.AddSingleton<LocaleOverrideContext>(); 362_innerBuilder.Services.AddHealthChecks(); 363_innerBuilder.Services.AddHttpClient(); 366_innerBuilder.Services.Configure<ResourceNotificationServiceOptions>(o => 372_innerBuilder.Services.AddSingleton<IAspireStore, AspireStore>(sp => 386_innerBuilder.Services.AddSingleton<IDeveloperCertificateService, DeveloperCertificateService>(); 391_innerBuilder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<DcpOptions>, ConfigureDefaultDcpOptions>()); 392_innerBuilder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IValidateOptions<DcpOptions>, ValidateDcpOptions>()); 395_innerBuilder.Services.AddHostedService<CliOrphanDetector>(); 396_innerBuilder.Services.AddSingleton<BackchannelService>(); 397_innerBuilder.Services.AddHostedService<BackchannelService>(sp => sp.GetRequiredService<BackchannelService>()); 398_innerBuilder.Services.AddSingleton<AuxiliaryBackchannelService>(); 399_innerBuilder.Services.AddHostedService<AuxiliaryBackchannelService>(sp => sp.GetRequiredService<AuxiliaryBackchannelService>()); 400_innerBuilder.Services.AddSingleton<AppHostRpcTarget>(); 469_innerBuilder.Services.AddOptions<TransportOptions>().ValidateOnStart().PostConfigure(MapTransportOptionsFromCustomKeys); 470_innerBuilder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IValidateOptions<TransportOptions>, TransportOptionsValidator>()); 471_innerBuilder.Services.AddSingleton<DashboardServiceHost>(); 472_innerBuilder.Services.AddHostedService(sp => sp.GetRequiredService<DashboardServiceHost>()); 473_innerBuilder.Services.AddSingleton<IDashboardEndpointProvider, HostDashboardEndpointProvider>(); 474_innerBuilder.Services.AddEventingSubscriber<DashboardEventHandlers>(); 475_innerBuilder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<DashboardOptions>, ConfigureDefaultDashboardOptions>()); 476_innerBuilder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IValidateOptions<DashboardOptions>, ValidateDashboardOptions>()); 482_innerBuilder.Services.AddHostedService<ResourceLoggerForwarderService>(); 486_innerBuilder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<CodespacesOptions>, ConfigureCodespacesOptions>()); 487_innerBuilder.Services.AddSingleton<CodespacesUrlRewriter>(); 488_innerBuilder.Services.AddHostedService<CodespacesResourceUrlRewriterService>(); 489_innerBuilder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<DevcontainersOptions>, ConfigureDevcontainersOptions>()); 490_innerBuilder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<SshRemoteOptions>, ConfigureSshRemoteOptions>()); 491_innerBuilder.Services.AddSingleton<DevcontainerSettingsWriter>(); 492_innerBuilder.Services.TryAddEventingSubscriber<DevcontainerPortForwardingLifecycleHook>(); 496_innerBuilder.Services.TryAddSingleton<IRequiredCommandValidator, RequiredCommandValidator>(); 498_innerBuilder.Services.TryAddEventingSubscriber<RequiredCommandValidationLifecycleHook>(); 504_innerBuilder.Services.AddSingleton<ApplicationOrchestrator>(); 505_innerBuilder.Services.AddHostedService<OrchestratorHostService>(); 508_innerBuilder.Services.AddSingleton<IDcpExecutor, DcpExecutor>(); 509_innerBuilder.Services.AddSingleton<DcpExecutorEvents>(); 510_innerBuilder.Services.AddSingleton<DcpHost>(); 511_innerBuilder.Services.AddSingleton<IDcpDependencyCheckService, DcpDependencyCheck>(); 512_innerBuilder.Services.AddSingleton<DcpNameGenerator>(); 515_innerBuilder.Services.AddSingleton<Locations>(); 516_innerBuilder.Services.AddSingleton<IKubernetesService, KubernetesService>(); 524_innerBuilder.Services.AddKeyedSingleton<IContainerRuntime, DockerContainerRuntime>("docker"); 525_innerBuilder.Services.AddKeyedSingleton<IContainerRuntime, PodmanContainerRuntime>("podman"); 526_innerBuilder.Services.AddSingleton(sp => 535_innerBuilder.Services.AddSingleton<IResourceContainerImageManager, ResourceContainerImageManager>(); 536_innerBuilder.Services.AddSingleton<PipelineActivityReporter>(); 537_innerBuilder.Services.AddSingleton<IPipelineActivityReporter, PipelineActivityReporter>(sp => sp.GetRequiredService<PipelineActivityReporter>()); 538_innerBuilder.Services.AddSingleton<IPipelineOutputService, PipelineOutputService>(); 539_innerBuilder.Services.AddSingleton(Pipeline); 542_innerBuilder.Services.Configure<PipelineLoggingOptions>(options => 560_innerBuilder.Services.AddSingleton<ILoggerProvider, PipelineLoggerProvider>(); 563_innerBuilder.Services.AddOptions<LoggerFilterOptions>().Configure<IOptions<PipelineLoggingOptions>>((filterLoggingOptions, pipelineLoggingOptions) => 571_innerBuilder.Services.TryAddSingleton<IDeploymentStateManager, FileDeploymentStateManager>(); 575_innerBuilder.Services.TryAddSingleton<IDeploymentStateManager, UserSecretsDeploymentStateManager>(); 586_innerBuilder.Services.AddSingleton(ExecutionContext); 592_innerBuilder.Services.AddSingleton<IValidateOptions<HealthCheckServiceOptions>>(sp => 621_innerBuilder.Services.AddSingleton<IConfigureOptions<HealthCheckPublisherOptions>>(sp => 635_innerBuilder.Services.AddSingleton<ResourceHealthCheckService>(); 636_innerBuilder.Services.AddHostedService<ResourceHealthCheckService>(sp => sp.GetRequiredService<ResourceHealthCheckService>()); 680_innerBuilder.Services.Configure<PipelineOptions>(_innerBuilder.Configuration.GetSection("Pipeline")); 714_innerBuilder.Services
IDistributedApplicationBuilder.cs (1)
78/// <inheritdoc cref="HostApplicationBuilder.Services" />
Aspire.Hosting.Azure.Kusto.Tests (3)
KustoFunctionalTests.cs (3)
61hb.Services.AddSingleton<ICslQueryProvider>(sp => 113hb.Services.AddSingleton<ICslQueryProvider>(sp => 120hb.Services.AddSingleton<ICslAdminProvider>(sp =>
Aspire.Keycloak.Authentication.Tests (8)
AspireKeycloakExtensionTests.cs (8)
24builder.Services.AddAuthentication() 44builder.Services.AddAuthentication() 62builder.Services.AddAuthentication() 84builder.Services.AddAuthentication() 105builder.Services.AddAuthentication() 125builder.Services.AddAuthentication() 143builder.Services.AddAuthentication() 166builder.Services.AddAuthentication()
Aspire.Microsoft.EntityFrameworkCore.Cosmos.Tests (12)
AspireAzureEfCoreCosmosDBExtensionsTests.cs (4)
166builder.Services.AddDbContextPool<ITestDbContext, TestDbContext>(options => options.UseCosmos(ConnectionString, "databaseName")); 170builder.Services.AddDbContextPool<TestDbContext>(options => options.UseCosmos(ConnectionString, "databaseName")); 189builder.Services.AddDbContextPool<ITestDbContext, TestDbContext>(options => options.UseCosmos(ConnectionString, "databaseName")); 193builder.Services.AddDbContextPool<TestDbContext>(options => options.UseCosmos(ConnectionString, "databaseName"));
EnrichCosmosDbTests.cs (8)
22builder.Services.AddDbContextPool<TestDbContext>(options => options.UseCosmos(ConnectionString, DatabaseName)); 40builder.Services.AddDbContext<TestDbContext>(options => options.UseCosmos(ConnectionString, DatabaseName)); 55builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 88builder.Services.AddDbContextPool<ITestDbContext, TestDbContext>(optionsBuilder => 105builder.Services.AddDbContext<ITestDbContext, TestDbContext>(optionsBuilder => 112var optionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 126builder.Services.AddDbContextPool<ITestDbContext, TestDbContext>(optionsBuilder => 147builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder =>
Aspire.Microsoft.EntityFrameworkCore.SqlServer.Tests (21)
AspireSqlServerEFCoreSqlClientExtensionsTests.cs (4)
267builder.Services.AddDbContextPool<ITestDbContext, TestDbContext>(options => options.UseSqlServer(ConnectionString)); 271builder.Services.AddDbContextPool<TestDbContext>(options => options.UseSqlServer(ConnectionString)); 290builder.Services.AddDbContextPool<ITestDbContext, TestDbContext>(options => options.UseSqlServer(ConnectionString)); 294builder.Services.AddDbContextPool<TestDbContext>(options => options.UseSqlServer(ConnectionString));
EnrichSqlServerTests.cs (17)
26builder.Services.AddDbContextPool<TestDbContext>(options => options.UseSqlServer(ConnectionString)); 44builder.Services.AddDbContext<TestDbContext>(options => options.UseSqlServer(ConnectionString)); 62builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 97builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 117builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 122var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 152builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 160var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 166var optionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 195builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 203var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 229builder.Services.AddDbContextPool<ITestDbContext, TestDbContext>(optionsBuilder => 246builder.Services.AddDbContext<ITestDbContext, TestDbContext>(optionsBuilder => 253var optionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 267builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 295builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 312builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder =>
Aspire.MongoDB.EntityFrameworkCore.Tests (10)
AspireMongoDBEntityFrameworkCoreExtensionsTests.cs (4)
220builder.Services.AddDbContextPool<ITestDbContext, TestDbContext>(options => options.UseMongoDB(ConnectionString, DatabaseName)); 224builder.Services.AddDbContextPool<TestDbContext>(options => options.UseMongoDB(ConnectionString, DatabaseName)); 244builder.Services.AddDbContextPool<ITestDbContext, TestDbContext>(options => options.UseMongoDB(ConnectionString, DatabaseName)); 248builder.Services.AddDbContextPool<TestDbContext>(options => options.UseMongoDB(ConnectionString, DatabaseName));
EnrichMongoDbTests.cs (6)
24builder.Services.AddDbContextPool<TestDbContext>(options => options.UseMongoDB(ConnectionString, DatabaseName)); 42builder.Services.AddDbContext<TestDbContext>(options => options.UseMongoDB(ConnectionString, DatabaseName)); 57builder.Services.AddDbContextPool<ITestDbContext, TestDbContext>(optionsBuilder => 74builder.Services.AddDbContext<ITestDbContext, TestDbContext>(optionsBuilder => 81var optionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 99builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder =>
Aspire.NATS.Net.Tests (1)
AspireNatsClientExtensionsTests.cs (1)
219builder.Services.AddOpenTelemetry().WithTracing(builder => builder.AddProcessor(notifier));
Aspire.Npgsql.EntityFrameworkCore.PostgreSQL.Tests (22)
AspireEFPostgreSqlExtensionsTests.cs (4)
275builder.Services.AddDbContextPool<ITestDbContext, TestDbContext>(options => options.UseNpgsql(ConnectionString)); 279builder.Services.AddDbContextPool<TestDbContext>(options => options.UseNpgsql(ConnectionString)); 298builder.Services.AddDbContextPool<ITestDbContext, TestDbContext>(options => options.UseNpgsql(ConnectionString)); 302builder.Services.AddDbContextPool<TestDbContext>(options => options.UseNpgsql(ConnectionString));
EnrichNpgsqlTests.cs (18)
30builder.Services.AddDbContextPool<TestDbContext>(options => options.UseNpgsql(ConnectionString)); 48builder.Services.AddDbContext<TestDbContext>(options => options.UseNpgsql(ConnectionString)); 66builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 102builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 123builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 129var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 159builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 168var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 174var optionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 203builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 212var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 239builder.Services.AddDbContextPool<ITestDbContext, TestDbContext>(optionsBuilder => 257builder.Services.AddDbContext<ITestDbContext, TestDbContext>(optionsBuilder => 265var optionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 279builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 308builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 326builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 359builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder =>
Aspire.OpenAI.Tests (2)
AspireOpenAIClientBuilderChatClientExtensionsTests.cs (1)
237builder.Services.AddSingleton<ILoggerFactory, TestLoggerFactory>();
AspireOpenAIClientBuilderEmbeddingGeneratorExtensionsTests.cs (1)
237builder.Services.AddSingleton<ILoggerFactory, TestLoggerFactory>();
Aspire.Oracle.EntityFrameworkCore.Tests (23)
AspireOracleEFCoreDatabaseExtensionsTests.cs (4)
268builder.Services.AddDbContextPool<ITestDbContext, TestDbContext>(options => options.UseOracle(ConnectionString)); 272builder.Services.AddDbContextPool<TestDbContext>(options => options.UseOracle(ConnectionString)); 291builder.Services.AddDbContextPool<ITestDbContext, TestDbContext>(options => options.UseOracle(ConnectionString)); 295builder.Services.AddDbContextPool<TestDbContext>(options => options.UseOracle(ConnectionString));
ConformanceTests.cs (1)
152builder.Services.AddOpenTelemetry().WithTracing(builder =>
EnrichOracleDatabaseTests.cs (18)
26builder.Services.AddDbContextPool<TestDbContext>(options => options.UseOracle(ConnectionString)); 44builder.Services.AddDbContext<TestDbContext>(options => options.UseOracle(ConnectionString)); 62builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 97builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 117builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 122var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 152builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 160var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 166var optionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 195builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 203var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 229builder.Services.AddDbContextPool<ITestDbContext, TestDbContext>(optionsBuilder => 246builder.Services.AddDbContext<ITestDbContext, TestDbContext>(optionsBuilder => 253var optionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 267builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 295builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 312builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 344builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder =>
Aspire.Pomelo.EntityFrameworkCore.MySql.Tests (22)
AspireEFMySqlExtensionsTests.cs (4)
265builder.Services.AddDbContextPool<ITestDbContext, TestDbContext>(options => options.UseMySql(ConnectionString, s_serverVersion)); 269builder.Services.AddDbContextPool<TestDbContext>(options => options.UseMySql(ConnectionString, s_serverVersion)); 289builder.Services.AddDbContextPool<ITestDbContext, TestDbContext>(options => options.UseMySql(ConnectionString, s_serverVersion)); 293builder.Services.AddDbContextPool<TestDbContext>(options => options.UseMySql(ConnectionString, s_serverVersion));
EnrichMySqlTests.cs (18)
31builder.Services.AddDbContextPool<TestDbContext>((serviceProvider, options) => 60builder.Services.AddDbContext<TestDbContext>(options => options.UseMySql(ConnectionString, DefaultVersion)); 78builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 113builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 133builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 138var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 168builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 176var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 182var optionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 211builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 219var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 245builder.Services.AddDbContextPool<ITestDbContext, TestDbContext>(optionsBuilder => 262builder.Services.AddDbContext<ITestDbContext, TestDbContext>(optionsBuilder => 269var optionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 283builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 311builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 328builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder => 360builder.Services.AddDbContextPool<TestDbContext>(optionsBuilder =>
Aspire.RabbitMQ.Client.Tests (11)
AspireRabbitMQExtensionsTests.cs (4)
219var connection = builder.Services.BuildServiceProvider() 223builder.Services.AddKeyedSingleton<IConnection>(useKeyed ? "messaging" : null, (sp, key) => 247var connection = builder.Services.BuildServiceProvider() 251builder.Services.AddSingleton<IConnection>(sp =>
AspireRabbitMQLoggingTests.cs (7)
61builder.Services.AddSingleton<ILoggerProvider>(sp => new LoggerProvider(logger)); 82builder.Services.AddSingleton<RabbitMQEventSourceLogForwarder>(); 85builder.Services.AddSingleton<ILoggerProvider>(sp => new LoggerProvider(logger)); 111builder.Services.AddSingleton<RabbitMQEventSourceLogForwarder>(); 114builder.Services.AddSingleton<ILoggerProvider>(sp => new LoggerProvider(logger)); 156builder.Services.AddSingleton<RabbitMQEventSourceLogForwarder>(); 159builder.Services.AddSingleton<ILoggerProvider>(sp => new LoggerProvider(logger));
Aspire.RabbitMQ.Client.v6.Tests (11)
tests\Aspire.RabbitMQ.Client.Tests\AspireRabbitMQExtensionsTests.cs (4)
219var connection = builder.Services.BuildServiceProvider() 223builder.Services.AddKeyedSingleton<IConnection>(useKeyed ? "messaging" : null, (sp, key) => 247var connection = builder.Services.BuildServiceProvider() 251builder.Services.AddSingleton<IConnection>(sp =>
tests\Aspire.RabbitMQ.Client.Tests\AspireRabbitMQLoggingTests.cs (7)
61builder.Services.AddSingleton<ILoggerProvider>(sp => new LoggerProvider(logger)); 82builder.Services.AddSingleton<RabbitMQEventSourceLogForwarder>(); 85builder.Services.AddSingleton<ILoggerProvider>(sp => new LoggerProvider(logger)); 111builder.Services.AddSingleton<RabbitMQEventSourceLogForwarder>(); 114builder.Services.AddSingleton<ILoggerProvider>(sp => new LoggerProvider(logger)); 156builder.Services.AddSingleton<RabbitMQEventSourceLogForwarder>(); 159builder.Services.AddSingleton<ILoggerProvider>(sp => new LoggerProvider(logger));
Aspire.StackExchange.Redis.DistributedCaching.Tests (2)
DistributedCacheConformanceTests.cs (2)
54builder.Services.AddOpenTelemetry().WithTracing(builder => builder.AddProcessor(notifier)); 56builder.Services.Configure<StackExchangeRedisInstrumentationOptions>(options => options.FlushInterval = TimeSpan.Zero);
Aspire.StackExchange.Redis.OutputCaching.Tests (2)
OutputCacheConformanceTests.cs (2)
54builder.Services.AddOpenTelemetry().WithTracing(builder => builder.AddProcessor(notifier)); 56builder.Services.Configure<StackExchangeRedisInstrumentationOptions>(options => options.FlushInterval = TimeSpan.Zero);
Aspire.StackExchange.Redis.Tests (5)
AspireRedisExtensionsTests.cs (5)
44builder.Services.Configure<ConfigurationOptions>(options => 275builder.Services.AddOpenTelemetry().WithTracing(builder => builder.AddProcessor(notifier)); 277builder.Services.Configure<StackExchangeRedisInstrumentationOptions>(options => options.FlushInterval = TimeSpan.Zero); 463builder.Services.AddKeyedSingleton<IConnectionMultiplexer>(useKeyed ? "redis" : null, (sp, key) => 486builder.Services.AddSingleton<IConnectionMultiplexer>(sp =>
aspire-server (1)
RemoteHostServer.cs (1)
30ConfigureServices(builder.Services);
AzureKusto.Worker (7)
Program.cs (7)
20builder.Services.AddSingleton(sp => 24builder.Services.AddSingleton(sp => 28builder.Services.AddSingleton(sp => 33builder.Services.AddResiliencePipeline("kusto-resilience", builder => 44builder.Services.AddOptions<WorkerOptions>(); 46builder.Services.AddHostedService<QueryWorker>(); 47builder.Services.AddHostedService<IngestionWorker>();
Consumer (1)
Program.cs (1)
12builder.Services.AddHostedService<ConsumerWorker>();
DatabaseMigration.MigrationService (2)
Program.cs (2)
8builder.Services.AddHostedService<ApiDbInitializer>(); 12builder.Services.AddOpenTelemetry()
EventHubsConsumer (2)
Program.cs (2)
15builder.Services.AddHostedService<Consumer>(); 25builder.Services.AddHostedService<Processor>();
Microsoft.AspNetCore (8)
BootstrapHostBuilder.cs (5)
24foreach (var descriptor in _builder.Services) 101configureServicesAction(Context, _builder.Services); 106for (int i = _builder.Services.Count - 1; i >= 0; i--) 108var descriptor = _builder.Services[i]; 114_builder.Services.RemoveAt(i);
WebApplicationBuilder.cs (3)
106AddDefaultServicesSlim(configuration, _hostApplicationBuilder.Services); 339public IServiceCollection Services => _hostApplicationBuilder.Services; 382_hostApplicationBuilder.Services.Add(_genericWebHostServiceDescriptor);
Microsoft.Extensions.AmbientMetadata.Application.Tests (1)
AcceptanceTests.cs (1)
93.Services.AddApplicationMetadata(metadata =>
Microsoft.Extensions.AmbientMetadata.Build.Tests (1)
ConfigurationBindingQuirkBehaviorTests.cs (1)
81_ = hostBuilder.Services.AddBuildMetadata(hostBuilder.Configuration.GetSection(sectionName));
Microsoft.Extensions.Hosting (12)
HostApplicationBuilder.cs (12)
107HostingHostBuilderExtensions.AddDefaultServices(_hostBuilderContext, Services); 115_configureContainer(Services); 116return serviceProviderOptions is null ? Services.BuildServiceProvider() : Services.BuildServiceProvider(serviceProviderOptions); 133_configureContainer(Services); 134return Services.BuildServiceProvider(); 179Services, 186logging = new LoggingBuilder(Services); 187metrics = new MetricsBuilder(Services); 219TContainerBuilder containerBuilder = factory.CreateBuilder(Services); 314configureServicesAction(_hostApplicationBuilder._hostBuilderContext, _hostApplicationBuilder.Services); 335object containerBuilder = _serviceProviderFactory.CreateBuilder(_hostApplicationBuilder.Services);
Microsoft.Extensions.Hosting.Systemd (1)
SystemdHostBuilderExtensions.cs (1)
64/// For example, <see cref="HostApplicationBuilder.Services"/> or the <see cref="IServiceCollection"/> passed to the
Microsoft.Extensions.Hosting.WindowsServices (2)
WindowsServiceLifetimeHostBuilderExtensions.cs (2)
71/// For example, <see cref="HostApplicationBuilder.Services"/> or the <see cref="IServiceCollection"/> passed to the 90/// For example, <see cref="HostApplicationBuilder.Services"/> or the <see cref="IServiceCollection"/> passed to the
OrderProcessor (1)
Program.cs (1)
8builder.Services.AddHostedService<OrderProcessingWorker>();
Producer (2)
Program.cs (2)
13builder.Services.AddHostedService<IntermittentProducerWorker>(); 14builder.Services.AddHostedService<ContinuousProducerWorker>();
ServiceBusWorker (4)
Program.cs (4)
10builder.Services.AddSingleton(sp => 15builder.Services.AddSingleton(sp => 25builder.Services.AddHostedService<Consumer>(); 26builder.Services.AddHostedService<Producer>();
Stress.TelemetryService (4)
Program.cs (4)
7builder.Services.AddHostedService<TelemetryStresser>(); 8builder.Services.AddHostedService<GaugeMetrics>(); 9builder.Services.AddHostedService<CounterMetrics>(); 14builder.Services.AddOpenTelemetry()
TestProject.WorkerA (1)
Program.cs (1)
7builder.Services.AddHostedService<Worker>();