2 implementations of Services
Microsoft.AspNetCore (1)
WebApplicationBuilder.cs (1)
337public IServiceCollection Services => _hostApplicationBuilder.Services;
Microsoft.Extensions.Hosting (1)
HostApplicationBuilder.cs (1)
204public IServiceCollection Services => _serviceCollection;
206 references to Services
Aspire.Azure.AI.OpenAI (8)
AspireAzureOpenAIExtensions.cs (2)
46builder.Services.TryAddSingleton(typeof(OpenAIClient), static provider => provider.GetRequiredService<AzureOpenAIClient>()); 70builder.Services.TryAddKeyedSingleton(typeof(OpenAIClient), serviceKey: name, static (provider, key) => provider.GetRequiredKeyedService<AzureOpenAIClient>(key));
src\Components\Common\AzureComponent.cs (5)
86builder.Services.AddSingleton<TClient>(static _ => null!); 89builder.Services.AddAzureClients(azureFactoryBuilder => 109builder.Services.AddKeyedSingleton(serviceKey, 138builder.Services.AddOpenTelemetry() 144builder.Services.AddOpenTelemetry()
src\Components\Common\HealthChecksExtensions.cs (1)
29addHealthCheck(builder.Services.AddHealthChecks());
Aspire.Azure.Data.Tables (6)
src\Components\Common\AzureComponent.cs (5)
86builder.Services.AddSingleton<TClient>(static _ => null!); 89builder.Services.AddAzureClients(azureFactoryBuilder => 109builder.Services.AddKeyedSingleton(serviceKey, 138builder.Services.AddOpenTelemetry() 144builder.Services.AddOpenTelemetry()
src\Components\Common\HealthChecksExtensions.cs (1)
29addHealthCheck(builder.Services.AddHealthChecks());
Aspire.Azure.Messaging.EventHubs (6)
src\Components\Common\AzureComponent.cs (5)
86builder.Services.AddSingleton<TClient>(static _ => null!); 89builder.Services.AddAzureClients(azureFactoryBuilder => 109builder.Services.AddKeyedSingleton(serviceKey, 138builder.Services.AddOpenTelemetry() 144builder.Services.AddOpenTelemetry()
src\Components\Common\HealthChecksExtensions.cs (1)
29addHealthCheck(builder.Services.AddHealthChecks());
Aspire.Azure.Messaging.ServiceBus (6)
src\Components\Common\AzureComponent.cs (5)
86builder.Services.AddSingleton<TClient>(static _ => null!); 89builder.Services.AddAzureClients(azureFactoryBuilder => 109builder.Services.AddKeyedSingleton(serviceKey, 138builder.Services.AddOpenTelemetry() 144builder.Services.AddOpenTelemetry()
src\Components\Common\HealthChecksExtensions.cs (1)
29addHealthCheck(builder.Services.AddHealthChecks());
Aspire.Azure.Messaging.WebPubSub (6)
src\Components\Common\AzureComponent.cs (5)
86builder.Services.AddSingleton<TClient>(static _ => null!); 89builder.Services.AddAzureClients(azureFactoryBuilder => 109builder.Services.AddKeyedSingleton(serviceKey, 138builder.Services.AddOpenTelemetry() 144builder.Services.AddOpenTelemetry()
src\Components\Common\HealthChecksExtensions.cs (1)
29addHealthCheck(builder.Services.AddHealthChecks());
Aspire.Azure.Search.Documents (6)
src\Components\Common\AzureComponent.cs (5)
86builder.Services.AddSingleton<TClient>(static _ => null!); 89builder.Services.AddAzureClients(azureFactoryBuilder => 109builder.Services.AddKeyedSingleton(serviceKey, 138builder.Services.AddOpenTelemetry() 144builder.Services.AddOpenTelemetry()
src\Components\Common\HealthChecksExtensions.cs (1)
29addHealthCheck(builder.Services.AddHealthChecks());
Aspire.Azure.Security.KeyVault (6)
src\Components\Common\AzureComponent.cs (5)
86builder.Services.AddSingleton<TClient>(static _ => null!); 89builder.Services.AddAzureClients(azureFactoryBuilder => 109builder.Services.AddKeyedSingleton(serviceKey, 138builder.Services.AddOpenTelemetry() 144builder.Services.AddOpenTelemetry()
src\Components\Common\HealthChecksExtensions.cs (1)
29addHealthCheck(builder.Services.AddHealthChecks());
Aspire.Azure.Storage.Blobs (6)
src\Components\Common\AzureComponent.cs (5)
86builder.Services.AddSingleton<TClient>(static _ => null!); 89builder.Services.AddAzureClients(azureFactoryBuilder => 109builder.Services.AddKeyedSingleton(serviceKey, 138builder.Services.AddOpenTelemetry() 144builder.Services.AddOpenTelemetry()
src\Components\Common\HealthChecksExtensions.cs (1)
29addHealthCheck(builder.Services.AddHealthChecks());
Aspire.Azure.Storage.Queues (6)
src\Components\Common\AzureComponent.cs (5)
86builder.Services.AddSingleton<TClient>(static _ => null!); 89builder.Services.AddAzureClients(azureFactoryBuilder => 109builder.Services.AddKeyedSingleton(serviceKey, 138builder.Services.AddOpenTelemetry() 144builder.Services.AddOpenTelemetry()
src\Components\Common\HealthChecksExtensions.cs (1)
29addHealthCheck(builder.Services.AddHealthChecks());
Aspire.Confluent.Kafka (19)
AspireKafkaConsumerExtensions.cs (9)
116builder.Services.AddSingleton<ConsumerConnectionFactory<TKey, TValue>>(sp => CreateConsumerConnectionFactory<TKey, TValue>(sp, configureBuilder, settings)); 117builder.Services.AddSingleton<IConsumer<TKey, TValue>>(sp => sp.GetRequiredService<ConsumerConnectionFactory<TKey, TValue>>().Create()); 121builder.Services.AddKeyedSingleton<ConsumerConnectionFactory<TKey, TValue>>(serviceKey, (sp, key) => CreateConsumerConnectionFactory<TKey, TValue>(sp, configureBuilder, settings)); 122builder.Services.AddKeyedSingleton<IConsumer<TKey, TValue>>(serviceKey, (sp, key) => sp.GetRequiredKeyedService<ConsumerConnectionFactory<TKey, TValue>>(key).Create()); 127builder.Services.TryAddSingleton<MetricsChannel>(); 128builder.Services.AddHostedService<MetricsService>(); 129builder.Services.TryAddSingleton<ConfluentKafkaMetrics>(); 130builder.Services.AddOpenTelemetry().WithMetrics(metricBuilderProvider => metricBuilderProvider.AddMeter(ConfluentKafkaCommon.MeterName)); 139builder.Services.TryAddKeyedSingleton<KafkaHealthCheck>(healthCheckName,
AspireKafkaProducerExtensions.cs (9)
116builder.Services.AddSingleton<ProducerConnectionFactory<TKey, TValue>>(sp => CreateProducerConnectionFactory<TKey, TValue>(sp, configureBuilder, settings)); 117builder.Services.AddSingleton<IProducer<TKey, TValue>>(sp => sp.GetRequiredService<ProducerConnectionFactory<TKey, TValue>>().Create()); 121builder.Services.AddKeyedSingleton<ProducerConnectionFactory<TKey, TValue>>(serviceKey, (sp, key) => CreateProducerConnectionFactory<TKey, TValue>(sp, configureBuilder, settings)); 122builder.Services.AddKeyedSingleton<IProducer<TKey, TValue>>(serviceKey, (sp, key) => sp.GetRequiredKeyedService<ProducerConnectionFactory<TKey, TValue>>(key).Create()); 127builder.Services.TryAddSingleton<MetricsChannel>(); 128builder.Services.AddHostedService<MetricsService>(); 129builder.Services.TryAddSingleton<ConfluentKafkaMetrics>(); 130builder.Services.AddOpenTelemetry().WithMetrics(metricBuilderProvider => metricBuilderProvider.AddMeter(ConfluentKafkaCommon.MeterName)); 139builder.Services.TryAddKeyedSingleton<KafkaHealthCheck>(healthCheckName,
src\Components\Common\HealthChecksExtensions.cs (1)
29addHealthCheck(builder.Services.AddHealthChecks());
Aspire.Elastic.Clients.Elasticsearch (4)
AspireElasticClientsElasticsearchExtensions.cs (3)
91builder.Services.AddSingleton<ElasticsearchClient>(CreateElasticsearchClient); 95builder.Services.AddKeyedSingleton<ElasticsearchClient>(serviceKey, (sp, key) => CreateElasticsearchClient(sp)); 100builder.Services
src\Components\Common\HealthChecksExtensions.cs (1)
29addHealthCheck(builder.Services.AddHealthChecks());
Aspire.Microsoft.Azure.Cosmos (3)
AspireMicrosoftAzureCosmosExtensions.cs (3)
93builder.Services.AddOpenTelemetry().WithTracing(tracerProviderBuilder => 116builder.Services.AddSingleton(_ => ConfigureDb()); 120builder.Services.AddKeyedSingleton(serviceKey, (sp, key) => ConfigureDb());
Aspire.Microsoft.Data.SqlClient (4)
AspireSqlServerSqlClientExtensions.cs (3)
78builder.Services.AddScoped(_ => new SqlConnection(GetConnectionString())); 82builder.Services.AddKeyedScoped(serviceKey, (_, __) => new SqlConnection(GetConnectionString())); 89builder.Services.AddOpenTelemetry().WithTracing(tracerProviderBuilder =>
src\Components\Common\HealthChecksExtensions.cs (1)
29addHealthCheck(builder.Services.AddHealthChecks());
Aspire.Microsoft.EntityFrameworkCore.Cosmos (7)
AspireAzureEFCoreCosmosExtensions.cs (3)
68builder.Services.AddDbContextPool<TContext>(ConfigureDbContext); 139builder.Services.ConfigureDbContext<TContext>(optionsBuilder => 178builder.Services.AddOpenTelemetry().WithTracing(tracerProviderBuilder =>
src\Components\Common\EntityFrameworkUtils.cs (4)
41var oldDbContextOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TContext>)); 64builder.Services.Remove(oldDbContextOptionsDescriptor); 87builder.Services.Add(dbContextOptionsDescriptor); 97var oldDbContextOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TContext>));
Aspire.Microsoft.EntityFrameworkCore.SqlServer (8)
AspireSqlServerEFCoreSqlClientExtensions.cs (3)
59builder.Services.AddDbContextPool<TContext>(ConfigureDbContext); 119builder.Services.ConfigureDbContext<TContext>(optionsBuilder => optionsBuilder.ConfigureSqlEngine(options => 177builder.Services.AddOpenTelemetry().WithTracing(tracerProviderBuilder =>
src\Components\Common\EntityFrameworkUtils.cs (4)
41var oldDbContextOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TContext>)); 64builder.Services.Remove(oldDbContextOptionsDescriptor); 87builder.Services.Add(dbContextOptionsDescriptor); 97var oldDbContextOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TContext>));
src\Components\Common\HealthChecksExtensions.cs (1)
29addHealthCheck(builder.Services.AddHealthChecks());
Aspire.Milvus.Client (3)
AspireMilvusExtensions.cs (2)
83builder.Services.AddSingleton(ConfigureMilvus); 87builder.Services.AddKeyedSingleton(serviceKey, (sp, key) => ConfigureMilvus(sp));
src\Components\Common\HealthChecksExtensions.cs (1)
29addHealthCheck(builder.Services.AddHealthChecks());
Aspire.MongoDB.Driver (6)
AspireMongoDBDriverExtensions.cs (5)
91builder.Services 112.Services 118.Services 141builder.Services.AddSingleton<IMongoDatabase>(provider => 151builder.Services.AddKeyedSingleton<IMongoDatabase>(serviceKey, (provider, _) =>
src\Components\Common\HealthChecksExtensions.cs (1)
29addHealthCheck(builder.Services.AddHealthChecks());
Aspire.MySqlConnector (5)
AspireMySqlConnectorExtensions.cs (4)
90builder.Services.AddOpenTelemetry() 99builder.Services.AddOpenTelemetry() 111builder.Services.AddMySqlDataSource(settings.ConnectionString ?? string.Empty, dataSourceBuilder => 118builder.Services.AddKeyedMySqlDataSource(serviceKey, settings.ConnectionString ?? string.Empty, dataSourceBuilder =>
src\Components\Common\HealthChecksExtensions.cs (1)
29addHealthCheck(builder.Services.AddHealthChecks());
Aspire.NATS.Net (7)
AspireNatsClientExtensions.cs (6)
102builder.Services.TryAddSingleton(Factory); 103builder.Services.TryAddSingleton<INatsConnection>(static provider => provider.GetRequiredService<NatsConnection>()); 107builder.Services.TryAddKeyedSingleton<NatsConnection>(serviceKey, (provider, _) => Factory(provider)); 108builder.Services.TryAddKeyedSingleton<INatsConnection>(serviceKey, static (provider, key) => provider.GetRequiredKeyedService<NatsConnection>(key)); 125builder.Services 143builder.Services.AddSingleton<INatsJSContext>(static provider =>
src\Components\Common\HealthChecksExtensions.cs (1)
29addHealthCheck(builder.Services.AddHealthChecks());
Aspire.Npgsql (4)
AspirePostgreSqlNpgsqlExtensions.cs (3)
91builder.Services.AddOpenTelemetry() 100builder.Services.AddOpenTelemetry() 107builder.Services.AddNpgsqlDataSource(settings.ConnectionString ?? string.Empty, dataSourceBuilder =>
src\Components\Common\HealthChecksExtensions.cs (1)
29addHealthCheck(builder.Services.AddHealthChecks());
Aspire.Npgsql.EntityFrameworkCore.PostgreSQL (9)
AspireEFPostgreSqlExtensions.cs (4)
67builder.Services.AddDbContextPool<TContext>(ConfigureDbContext); 130builder.Services.ConfigureDbContext<TContext>(ConfigureRetryAndTimeout); 200builder.Services.AddOpenTelemetry() 209builder.Services.AddOpenTelemetry()
src\Components\Common\EntityFrameworkUtils.cs (4)
41var oldDbContextOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TContext>)); 64builder.Services.Remove(oldDbContextOptionsDescriptor); 87builder.Services.Add(dbContextOptionsDescriptor); 97var oldDbContextOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TContext>));
src\Components\Common\HealthChecksExtensions.cs (1)
29addHealthCheck(builder.Services.AddHealthChecks());
Aspire.OpenAI (5)
AspireOpenAIExtensions.cs (5)
87builder.Services.Configure<OpenAIClientOptions>( 104builder.Services.AddSingleton(ConfigureOpenAI); 108builder.Services.AddKeyedSingleton(serviceKey, (sp, key) => ConfigureOpenAI(sp)); 113builder.Services.AddOpenTelemetry() 119builder.Services.AddOpenTelemetry()
Aspire.Oracle.EntityFrameworkCore (7)
AspireOracleEFCoreExtensions.cs (2)
60builder.Services.AddDbContextPool<TContext>(ConfigureDbContext); 180builder.Services.AddOpenTelemetry().WithTracing(tracerProviderBuilder =>
src\Components\Common\EntityFrameworkUtils.cs (4)
41var oldDbContextOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TContext>)); 64builder.Services.Remove(oldDbContextOptionsDescriptor); 87builder.Services.Add(dbContextOptionsDescriptor); 97var oldDbContextOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TContext>));
src\Components\Common\HealthChecksExtensions.cs (1)
29addHealthCheck(builder.Services.AddHealthChecks());
Aspire.Pomelo.EntityFrameworkCore.MySql (9)
AspireEFMySqlExtensions.cs (4)
71builder.Services.AddDbContextPool<TContext>(ConfigureDbContext); 74builder.Services.AddResiliencePipeline(resilienceKey, static builder => 243builder.Services.AddOpenTelemetry() 253builder.Services.AddOpenTelemetry()
src\Components\Common\EntityFrameworkUtils.cs (4)
41var oldDbContextOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TContext>)); 64builder.Services.Remove(oldDbContextOptionsDescriptor); 87builder.Services.Add(dbContextOptionsDescriptor); 97var oldDbContextOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TContext>));
src\Components\Common\HealthChecksExtensions.cs (1)
29addHealthCheck(builder.Services.AddHealthChecks());
Aspire.Qdrant.Client (3)
AspireQdrantExtensions.cs (2)
78builder.Services.AddSingleton(ConfigureQdrant); 82builder.Services.AddKeyedSingleton(serviceKey, (sp, key) => ConfigureQdrant(sp));
src\Components\Common\HealthChecksExtensions.cs (1)
29addHealthCheck(builder.Services.AddHealthChecks());
Aspire.RabbitMQ.Client (7)
AspireRabbitMQExtensions.cs (6)
114builder.Services.AddSingleton<IConnectionFactory>(CreateConnectionFactory); 115builder.Services.AddSingleton<IConnection>(sp => CreateConnection(sp.GetRequiredService<IConnectionFactory>(), settings.MaxConnectRetryCount)); 119builder.Services.AddKeyedSingleton<IConnectionFactory>(serviceKey, (sp, _) => CreateConnectionFactory(sp)); 120builder.Services.AddKeyedSingleton<IConnection>(serviceKey, (sp, key) => CreateConnection(sp.GetRequiredKeyedService<IConnectionFactory>(key), settings.MaxConnectRetryCount)); 123builder.Services.AddSingleton<RabbitMQEventSourceLogForwarder>(); 129builder.Services.AddOpenTelemetry()
src\Components\Common\HealthChecksExtensions.cs (1)
29addHealthCheck(builder.Services.AddHealthChecks());
Aspire.Seq (3)
AspireSeqExtensions.cs (2)
65builder.Services.Configure<OpenTelemetryLoggerOptions>(logging => logging.AddProcessor( 71builder.Services.ConfigureOpenTelemetryTracerProvider(tracing => tracing.AddProcessor(
src\Components\Common\HealthChecksExtensions.cs (1)
29addHealthCheck(builder.Services.AddHealthChecks());
Aspire.StackExchange.Redis (7)
AspireRedisExtensions.cs (6)
87builder.Services.AddKeyedTransient(optionsName, (sp, _) => new RedisSettingsAdapterService { Settings = settings }); 88builder.Services.TryAddTransient<IOptionsFactory<ConfigurationOptions>, ConfigurationOptionsFactory>(); 90builder.Services.Configure<ConfigurationOptions>( 102builder.Services.AddSingleton<IConnectionMultiplexer>(sp => CreateConnection(sp, connectionName, DefaultConfigSectionName, optionsName)); 106builder.Services.AddKeyedSingleton<IConnectionMultiplexer>(serviceKey, (sp, _) => CreateConnection(sp, connectionName, DefaultConfigSectionName, optionsName)); 116builder.Services.AddOpenTelemetry()
src\Components\Common\HealthChecksExtensions.cs (1)
29addHealthCheck(builder.Services.AddHealthChecks());
Aspire.StackExchange.Redis.DistributedCaching (2)
AspireRedisDistributedCacheExtensions.cs (2)
65builder.Services.AddStackExchangeRedisCache(static _ => { }); 67builder.Services.AddOptions<RedisCacheOptions>() // note that RedisCacheOptions doesn't support named options
Aspire.StackExchange.Redis.OutputCaching (2)
AspireRedisOutputCacheExtensions.cs (2)
64builder.Services.AddStackExchangeRedisOutputCache(static _ => { }); 66builder.Services.AddOptions<RedisOutputCacheOptions>() // note that RedisOutputCacheOptions doesn't support named options
Microsoft.AspNetCore.Tests (1)
WebApplicationTests.cs (1)
2525Assert.Same(builder.Services, iHostApplicationBuilder.Services);
OrleansServiceDefaults (5)
Extensions.cs (5)
23builder.Services.AddServiceDiscovery(); 25builder.Services.ConfigureHttpClientDefaults(http => 45builder.Services.AddOpenTelemetry() 74builder.Services.AddOpenTelemetry().UseOtlpExporter(); 89builder.Services.AddHealthChecks()
Playground.ServiceDefaults (5)
Extensions.cs (5)
23builder.Services.AddServiceDiscovery(); 25builder.Services.ConfigureHttpClientDefaults(http => 45builder.Services.AddOpenTelemetry() 71builder.Services.AddOpenTelemetry().UseOtlpExporter(); 86builder.Services.AddHealthChecks()
Seq.ServiceDefaults (5)
Extensions.cs (5)
23builder.Services.AddServiceDiscovery(); 25builder.Services.ConfigureHttpClientDefaults(http => 45builder.Services.AddOpenTelemetry() 73builder.Services.AddOpenTelemetry().UseOtlpExporter(); 88builder.Services.AddHealthChecks()
TestingAppHost1.ServiceDefaults (5)
Extensions.cs (5)
26builder.Services.AddServiceDiscovery(); 28builder.Services.ConfigureHttpClientDefaults(http => 54builder.Services.AddOpenTelemetry() 80builder.Services.AddOpenTelemetry().UseOtlpExporter(); 95builder.Services.AddHealthChecks()
TestShop.ServiceDefaults (5)
Extensions.cs (5)
23builder.Services.AddServiceDiscovery(); 25builder.Services.ConfigureHttpClientDefaults(http => 45builder.Services.AddOpenTelemetry() 70builder.Services.AddOpenTelemetry().UseOtlpExporter(); 85builder.Services.AddHealthChecks()