27 instantiations of ServiceDescriptor
Aspire.Azure.Npgsql.EntityFrameworkCore.PostgreSQL (1)
src\Components\Common\EntityFrameworkUtils.cs (1)
75var dbContextOptionsDescriptor = new ServiceDescriptor(
Aspire.Microsoft.EntityFrameworkCore.Cosmos (1)
src\Components\Common\EntityFrameworkUtils.cs (1)
75var dbContextOptionsDescriptor = new ServiceDescriptor(
Aspire.Microsoft.EntityFrameworkCore.SqlServer (1)
src\Components\Common\EntityFrameworkUtils.cs (1)
75var dbContextOptionsDescriptor = new ServiceDescriptor(
Aspire.Npgsql.EntityFrameworkCore.PostgreSQL (1)
src\Components\Common\EntityFrameworkUtils.cs (1)
75var dbContextOptionsDescriptor = new ServiceDescriptor(
Aspire.Oracle.EntityFrameworkCore (1)
src\Components\Common\EntityFrameworkUtils.cs (1)
75var dbContextOptionsDescriptor = new ServiceDescriptor(
Aspire.Pomelo.EntityFrameworkCore.MySql (1)
src\Components\Common\EntityFrameworkUtils.cs (1)
75var dbContextOptionsDescriptor = new ServiceDescriptor(
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore (1)
DatabaseDeveloperPageExceptionFilterServiceExtensions.cs (1)
30services.TryAddEnumerable(new ServiceDescriptor(typeof(IDeveloperPageExceptionFilter), typeof(DatabaseDeveloperPageExceptionFilter), ServiceLifetime.Singleton));
Microsoft.Extensions.AI (8)
ChatCompletion\ChatClientBuilderServiceCollectionExtensions.cs (2)
49serviceCollection.Add(new ServiceDescriptor(typeof(IChatClient), builder.Build, lifetime)); 93serviceCollection.Add(new ServiceDescriptor(typeof(IChatClient), serviceKey, factory: (services, serviceKey) => builder.Build(services), lifetime));
Embeddings\EmbeddingGeneratorBuilderServiceCollectionExtensions.cs (4)
55serviceCollection.Add(new ServiceDescriptor(typeof(IEmbeddingGenerator<TInput, TEmbedding>), builder.Build, lifetime)); 56serviceCollection.Add(new ServiceDescriptor(typeof(IEmbeddingGenerator), 107serviceCollection.Add(new ServiceDescriptor(typeof(IEmbeddingGenerator<TInput, TEmbedding>), serviceKey, factory: (services, serviceKey) => builder.Build(services), lifetime)); 108serviceCollection.Add(new ServiceDescriptor(typeof(IEmbeddingGenerator), serviceKey,
SpeechToText\SpeechToTextClientBuilderServiceCollectionExtensions.cs (2)
42serviceCollection.Add(new ServiceDescriptor(typeof(ISpeechToTextClient), builder.Build, lifetime)); 78serviceCollection.Add(new ServiceDescriptor(typeof(ISpeechToTextClient), serviceKey, factory: (services, serviceKey) => builder.Build(services), lifetime));
Microsoft.Extensions.DependencyInjection.Abstractions (12)
ServiceCollectionServiceExtensions.cs (3)
460var serviceDescriptor = new ServiceDescriptor(serviceType, implementationInstance); 491var descriptor = new ServiceDescriptor(serviceType, implementationType, lifetime); 502var descriptor = new ServiceDescriptor(serviceType, implementationFactory, lifetime);
ServiceCollectionServiceExtensions.Keyed.cs (3)
509var serviceDescriptor = new ServiceDescriptor(serviceType, serviceKey, implementationInstance); 543var descriptor = new ServiceDescriptor(serviceType, serviceKey, implementationType, lifetime); 555var descriptor = new ServiceDescriptor(serviceType, serviceKey, implementationFactory, lifetime);
ServiceDescriptor.cs (6)
935return new ServiceDescriptor(serviceType, implementationInstance); 955return new ServiceDescriptor(serviceType, serviceKey, implementationInstance); 985return new ServiceDescriptor(serviceType, implementationType, lifetime); 1004return new ServiceDescriptor(serviceType, serviceKey, implementationType, lifetime); 1018return new ServiceDescriptor(serviceType, implementationFactory, lifetime); 1033return new ServiceDescriptor(serviceType, serviceKey, implementationFactory, lifetime);
790 references to ServiceDescriptor
Aspire.Azure.AI.OpenAI (2)
AspireAzureOpenAIExtensions.cs (1)
61/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.ServiceKey"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
AspireConfigurableOpenAIExtensions.cs (1)
53/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.ServiceKey"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
Aspire.Azure.Data.Tables (1)
AspireTablesExtensions.cs (1)
51/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.ServiceKey"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
Aspire.Azure.Messaging.EventHubs (5)
AspireEventHubsExtensions.cs (5)
48/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.ServiceKey"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param> 94/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.ServiceKey"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param> 140/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.ServiceKey"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param> 187/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.ServiceKey"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param> 234/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.ServiceKey"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
Aspire.Azure.Messaging.ServiceBus (1)
AspireServiceBusExtensions.cs (1)
50/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.ServiceKey"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
Aspire.Azure.Messaging.WebPubSub (1)
AspireWebPubSubExtensions.cs (1)
50/// <param name="serviceKey">The name of the component, which is used as the <see cref="ServiceDescriptor.ServiceKey"/> of the service, as well as the hub name is hub name is not set in the settings</param>
Aspire.Azure.Npgsql (1)
AspireAzureNpgsqlExtensions.cs (1)
51/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.ServiceKey"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
Aspire.Azure.Npgsql.EntityFrameworkCore.PostgreSQL (5)
src\Components\Common\EntityFrameworkUtils.cs (5)
43public static ServiceDescriptor CheckDbContextRegistered<TContext>(this IHostApplicationBuilder builder, [CallerMemberName] string memberName = "") 50var oldDbContextOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TContext>)); 66var oldDbContextOptionsDescriptor = builder.CheckDbContextRegistered<TContext>(memberName); 75var dbContextOptionsDescriptor = new ServiceDescriptor( 106var oldDbContextOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TContext>));
Aspire.Azure.Npgsql.EntityFrameworkCore.PostgreSQL.Tests (5)
EnrichNpgsqlTests.cs (5)
127var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 166var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 172var optionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 213var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 266var optionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>));
Aspire.Azure.Search.Documents (1)
AspireAzureSearchExtensions.cs (1)
50/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.ServiceKey"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
Aspire.Azure.Security.KeyVault (1)
AspireKeyVaultExtensions.cs (1)
53/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.ServiceKey"/> of the service and also to retrieve the connection information from the ConnectionStrings configuration section.</param>
Aspire.Azure.Storage.Blobs (1)
AspireBlobStorageExtensions.cs (1)
51/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.ServiceKey"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
Aspire.Azure.Storage.Queues (1)
AspireQueueStorageExtensions.cs (1)
52/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.ServiceKey"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
Aspire.Confluent.Kafka (2)
AspireKafkaConsumerExtensions.cs (1)
100/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.ServiceKey"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
AspireKafkaProducerExtensions.cs (1)
100/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.ServiceKey"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
Aspire.Dashboard (2)
DashboardWebApplication.cs (2)
247builder.Services.TryAddEnumerable(ServiceDescriptor.Scoped<IOutgoingPeerResolver, ResourceOutgoingPeerResolver>()); 248builder.Services.TryAddEnumerable(ServiceDescriptor.Scoped<IOutgoingPeerResolver, BrowserLinkOutgoingPeerResolver>());
Aspire.Elastic.Clients.Elasticsearch (1)
AspireElasticClientsElasticsearchExtensions.cs (1)
44/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.ServiceKey"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
Aspire.Hosting (10)
Dashboard\DashboardServiceHost.cs (1)
107builder.Services.Add(ServiceDescriptor.Singleton(typeof(ILogger<>), typeof(Logger<>)));
DistributedApplicationBuilder.cs (7)
259_innerBuilder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<DcpOptions>, ConfigureDefaultDcpOptions>()); 260_innerBuilder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IValidateOptions<DcpOptions>, ValidateDcpOptions>()); 327_innerBuilder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IValidateOptions<TransportOptions>, TransportOptionsValidator>()); 332_innerBuilder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<DashboardOptions>, ConfigureDefaultDashboardOptions>()); 333_innerBuilder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IValidateOptions<DashboardOptions>, ValidateDashboardOptions>()); 358_innerBuilder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<CodespacesOptions>, ConfigureCodespacesOptions>()); 361_innerBuilder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<DevcontainersOptions>, ConfigureDevcontainersOptions>());
Lifecycle\LifecycleHookServiceCollectionExtensions.cs (2)
31services.TryAddEnumerable(ServiceDescriptor.Singleton<IDistributedApplicationLifecycleHook, T>()); 53services.TryAddEnumerable(ServiceDescriptor.Singleton<IDistributedApplicationLifecycleHook, T>(implementationFactory));
Aspire.Hosting.Testing (5)
DistributedApplicationFactory.cs (5)
558var hostDescriptor = applicationBuilder.Services.Single(s => s.ServiceType == typeof(IHost) && s.ServiceKey is null); 562var interceptedDescriptor = hostDescriptor switch 564{ ImplementationFactory: { } factory } => ServiceDescriptor.KeyedSingleton<IHost>(this, (sp, _) => (IHost)factory(sp)), 565{ ImplementationInstance: { } instance } => ServiceDescriptor.KeyedSingleton<IHost>(this, (IHost)instance), 566{ ImplementationType: { } type } => ServiceDescriptor.KeyedSingleton(typeof(IHost), this, type),
Aspire.Hosting.Tests (1)
WithHttpCommandTests.cs (1)
28var httpClientFactoryServiceDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(IHttpClientFactory));
Aspire.Microsoft.Azure.Cosmos (3)
AspireMicrosoftAzureCosmosExtensions.cs (3)
83/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.ServiceKey"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param> 109/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.ServiceKey"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param> 170/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.ServiceKey"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
Aspire.Microsoft.Data.SqlClient (1)
AspireSqlServerSqlClientExtensions.cs (1)
39/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.ServiceKey"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
Aspire.Microsoft.EntityFrameworkCore.Cosmos (5)
src\Components\Common\EntityFrameworkUtils.cs (5)
43public static ServiceDescriptor CheckDbContextRegistered<TContext>(this IHostApplicationBuilder builder, [CallerMemberName] string memberName = "") 50var oldDbContextOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TContext>)); 66var oldDbContextOptionsDescriptor = builder.CheckDbContextRegistered<TContext>(memberName); 75var dbContextOptionsDescriptor = new ServiceDescriptor( 106var oldDbContextOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TContext>));
Aspire.Microsoft.EntityFrameworkCore.Cosmos.Tests (1)
EnrichCosmosDbTests.cs (1)
112var optionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>));
Aspire.Microsoft.EntityFrameworkCore.SqlServer (5)
src\Components\Common\EntityFrameworkUtils.cs (5)
43public static ServiceDescriptor CheckDbContextRegistered<TContext>(this IHostApplicationBuilder builder, [CallerMemberName] string memberName = "") 50var oldDbContextOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TContext>)); 66var oldDbContextOptionsDescriptor = builder.CheckDbContextRegistered<TContext>(memberName); 75var dbContextOptionsDescriptor = new ServiceDescriptor( 106var oldDbContextOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TContext>));
Aspire.Microsoft.EntityFrameworkCore.SqlServer.Tests (5)
EnrichSqlServerTests.cs (5)
122var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 160var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 166var optionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 203var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 253var optionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>));
Aspire.MongoDB.Driver (1)
AspireMongoDBDriverExtensions.cs (1)
45/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.ServiceKey"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
Aspire.MySqlConnector (1)
AspireMySqlConnectorExtensions.cs (1)
40/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.ServiceKey"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
Aspire.NATS.Net (1)
AspireNatsClientExtensions.cs (1)
104/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.ServiceKey"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
Aspire.Npgsql (1)
AspirePostgreSqlNpgsqlExtensions.cs (1)
40/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.ServiceKey"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
Aspire.Npgsql.EntityFrameworkCore.PostgreSQL (5)
src\Components\Common\EntityFrameworkUtils.cs (5)
43public static ServiceDescriptor CheckDbContextRegistered<TContext>(this IHostApplicationBuilder builder, [CallerMemberName] string memberName = "") 50var oldDbContextOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TContext>)); 66var oldDbContextOptionsDescriptor = builder.CheckDbContextRegistered<TContext>(memberName); 75var dbContextOptionsDescriptor = new ServiceDescriptor( 106var oldDbContextOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TContext>));
Aspire.Npgsql.EntityFrameworkCore.PostgreSQL.Tests (5)
EnrichNpgsqlTests.cs (5)
129var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 168var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 174var optionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 212var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 265var optionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>));
Aspire.OpenAI (1)
AspireOpenAIExtensions.cs (1)
41/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.ServiceKey"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
Aspire.Oracle.EntityFrameworkCore (5)
src\Components\Common\EntityFrameworkUtils.cs (5)
43public static ServiceDescriptor CheckDbContextRegistered<TContext>(this IHostApplicationBuilder builder, [CallerMemberName] string memberName = "") 50var oldDbContextOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TContext>)); 66var oldDbContextOptionsDescriptor = builder.CheckDbContextRegistered<TContext>(memberName); 75var dbContextOptionsDescriptor = new ServiceDescriptor( 106var oldDbContextOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TContext>));
Aspire.Oracle.EntityFrameworkCore.Tests (5)
EnrichOracleDatabaseTests.cs (5)
122var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 160var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 166var optionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 203var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 253var optionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>));
Aspire.Pomelo.EntityFrameworkCore.MySql (5)
src\Components\Common\EntityFrameworkUtils.cs (5)
43public static ServiceDescriptor CheckDbContextRegistered<TContext>(this IHostApplicationBuilder builder, [CallerMemberName] string memberName = "") 50var oldDbContextOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TContext>)); 66var oldDbContextOptionsDescriptor = builder.CheckDbContextRegistered<TContext>(memberName); 75var dbContextOptionsDescriptor = new ServiceDescriptor( 106var oldDbContextOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TContext>));
Aspire.Pomelo.EntityFrameworkCore.MySql.Tests (5)
EnrichMySqlTests.cs (5)
136var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 174var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 180var optionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 217var oldOptionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>)); 267var optionsDescriptor = builder.Services.FirstOrDefault(sd => sd.ServiceType == typeof(DbContextOptions<TestDbContext>));
Aspire.RabbitMQ.Client (1)
AspireRabbitMQExtensions.cs (1)
50/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.ServiceKey"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
Aspire.StackExchange.Redis (1)
AspireRedisExtensions.cs (1)
46/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.ServiceKey"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
Aspire.StackExchange.Redis.DistributedCaching (1)
AspireRedisDistributedCacheExtensions.cs (1)
51/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.ServiceKey"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
Aspire.StackExchange.Redis.OutputCaching (1)
AspireRedisOutputCacheExtensions.cs (1)
50/// <param name="name">The name of the component, which is used as the <see cref="ServiceDescriptor.ServiceKey"/> of the service and also to retrieve the connection string from the ConnectionStrings configuration section.</param>
IntegrationTestsWebsite (1)
Startup.cs (1)
25services.TryAddEnumerable(ServiceDescriptor.Singleton<IServiceMethodProvider<DynamicService>, DynamicServiceModelProvider>());
Microsoft.AspNetCore (7)
BootstrapHostBuilder.cs (4)
24foreach (var descriptor in _builder.Services) 85public ServiceDescriptor RunDefaultCallbacks() 104ServiceDescriptor? genericWebHostServiceDescriptor = null; 108var descriptor = _builder.Services[i];
WebApplicationBuilder.cs (3)
30private readonly ServiceDescriptor _genericWebHostServiceDescriptor; 202private ServiceDescriptor InitializeHosting(BootstrapHostBuilder bootstrapHostBuilder) 206var genericWebHostServiceDescriptor = bootstrapHostBuilder.RunDefaultCallbacks();
Microsoft.AspNetCore.Antiforgery (1)
AntiforgeryServiceCollectionExtensions.cs (1)
29ServiceDescriptor.Transient<IConfigureOptions<AntiforgeryOptions>, AntiforgeryOptionsSetup>());
Microsoft.AspNetCore.AsyncState.Tests (1)
AsyncStateHttpContextExtensionsTests.cs (1)
28var serviceDescriptor = services.First(x => x.ServiceType == typeof(IHttpContextAccessor));
Microsoft.AspNetCore.Authentication (2)
AuthenticationBuilder.cs (2)
52Services.TryAddEnumerable(ServiceDescriptor.Singleton<IPostConfigureOptions<TOptions>, PostConfigureAuthenticationSchemeOptions<TOptions>>()); 97Services.TryAddEnumerable(ServiceDescriptor.Singleton<IPostConfigureOptions<TOptions>, EnsureSignInScheme<TOptions>>());
Microsoft.AspNetCore.Authentication.BearerToken (2)
BearerTokenExtensions.cs (2)
68builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<JsonOptions>, BearerTokenConfigureJsonOptions>()); 69builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<BearerTokenOptions>, BearerTokenConfigureOptions>());
Microsoft.AspNetCore.Authentication.Cookies (1)
CookieExtensions.cs (1)
79builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IPostConfigureOptions<CookieAuthenticationOptions>, PostConfigureCookieAuthenticationOptions>());
Microsoft.AspNetCore.Authentication.JwtBearer (2)
JwtBearerExtensions.cs (2)
77builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<JwtBearerOptions>, JwtBearerConfigureOptions>()); 78builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IPostConfigureOptions<JwtBearerOptions>, JwtBearerPostConfigureOptions>());
Microsoft.AspNetCore.Authentication.Negotiate (2)
NegotiateExtensions.cs (2)
71builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IPostConfigureOptions<NegotiateOptions>, PostConfigureNegotiateOptions>()); 72builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IStartupFilter>(new NegotiateOptionsValidationStartupFilter(authenticationScheme)));
Microsoft.AspNetCore.Authentication.OAuth (1)
OAuthExtensions.cs (1)
62builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IPostConfigureOptions<TOptions>, OAuthPostConfigureOptions<TOptions, THandler>>());
Microsoft.AspNetCore.Authentication.OpenIdConnect (2)
OpenIdConnectExtensions.cs (2)
71builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<OpenIdConnectOptions>, OpenIdConnectConfigureOptions>()); 72builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IPostConfigureOptions<OpenIdConnectOptions>, OpenIdConnectPostConfigureOptions>());
Microsoft.AspNetCore.Authentication.Twitter (1)
TwitterExtensions.cs (1)
69builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IPostConfigureOptions<TwitterOptions>, TwitterPostConfigureOptions>());
Microsoft.AspNetCore.Authentication.WsFederation (1)
WsFederationExtensions.cs (1)
53builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IPostConfigureOptions<WsFederationOptions>, WsFederationPostConfigureOptions>());
Microsoft.AspNetCore.Authorization (7)
AuthorizationServiceCollectionExtensions.cs (7)
32services.TryAdd(ServiceDescriptor.Singleton<AuthorizationMetrics, AuthorizationMetrics>()); 33services.TryAdd(ServiceDescriptor.Transient<IAuthorizationService, DefaultAuthorizationServiceImpl>()); 34services.TryAdd(ServiceDescriptor.Transient<IAuthorizationPolicyProvider, DefaultAuthorizationPolicyProvider>()); 35services.TryAdd(ServiceDescriptor.Transient<IAuthorizationHandlerProvider, DefaultAuthorizationHandlerProvider>()); 36services.TryAdd(ServiceDescriptor.Transient<IAuthorizationEvaluator, DefaultAuthorizationEvaluator>()); 37services.TryAdd(ServiceDescriptor.Transient<IAuthorizationHandlerContextFactory, DefaultAuthorizationHandlerContextFactory>()); 38services.TryAddEnumerable(ServiceDescriptor.Transient<IAuthorizationHandler, PassThroughAuthorizationHandler>());
Microsoft.AspNetCore.Components (6)
CascadingValueServiceCollectionExtensions.cs (3)
68ServiceDescriptor.Scoped<ICascadingValueSupplier, CascadingValueSource<TValue>>( 86ServiceDescriptor.Scoped<ICascadingValueSupplier, CascadingValueSource<TValue>>( 107ServiceDescriptor.Scoped<ICascadingValueSupplier, CascadingValueSource<TValue>>(sourceFactory));
RegisterPersistentComponentStateServiceCollectionExtensions.cs (1)
38services.TryAddEnumerable(ServiceDescriptor.Singleton<IPersistentServiceRegistration>(new PersistentServiceRegistration<TService>(componentRenderMode)));
SupplyParameterFromPersistentComponentStateProviderServiceCollectionExtensions.cs (1)
21services.TryAddEnumerable(ServiceDescriptor.Scoped<ICascadingValueSupplier, SupplyParameterFromPersistentComponentStateValueProvider>());
SupplyParameterFromQueryProviderServiceCollectionExtensions.cs (1)
22services.TryAddEnumerable(ServiceDescriptor.Scoped<ICascadingValueSupplier, SupplyParameterFromQueryValueProvider>());
Microsoft.AspNetCore.Components.Endpoints (1)
DependencyInjection\RazorComponentsServiceCollectionExtensions.cs (1)
68ServiceDescriptor.Singleton<IPostConfigureOptions<RazorComponentsServiceOptions>, DefaultRazorComponentsServiceOptionsConfiguration>());
Microsoft.AspNetCore.Components.Endpoints.Tests (4)
HotReloadServiceTests.cs (1)
220services.TryAddEnumerable(ServiceDescriptor.Singleton(typeof(RenderModeEndpointProvider), type));
RazorComponentEndpointDataSourceTest.cs (1)
223services.TryAddEnumerable(ServiceDescriptor.Singleton(typeof(RenderModeEndpointProvider), type));
RazorComponentsServiceCollectionExtensionsTest.cs (2)
27foreach (var service in services) 56foreach (var service in services)
Microsoft.AspNetCore.Components.Server (4)
DependencyInjection\ComponentServiceCollectionExtensions.cs (3)
59services.TryAddEnumerable(ServiceDescriptor.Singleton<IHubProtocol, BlazorPackHubProtocol>()); 94services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<CircuitOptions>, CircuitOptionsJSInteropDetailedErrorsConfiguration>()); 95services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<CircuitOptions>, CircuitOptionsJavaScriptInitializersConfiguration>());
DependencyInjection\ServerRazorComponentsBuilderExtensions.cs (1)
38builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<RenderModeEndpointProvider, CircuitEndpointProvider>());
Microsoft.AspNetCore.Components.Web (1)
Forms\Mapping\SupplyParameterFromFormServiceCollectionExtensions.cs (1)
21serviceCollection.TryAddEnumerable(ServiceDescriptor.Scoped<ICascadingValueSupplier, SupplyParameterFromFormValueProvider>(services =>
Microsoft.AspNetCore.Components.WebAssembly.Server (2)
WebAssemblyRazorComponentsBuilderExtensions.cs (2)
26builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<RenderModeEndpointProvider, WebAssemblyEndpointProvider>()); 41builder.Services.TryAddEnumerable(ServiceDescriptor.Scoped<IHostEnvironmentAuthenticationStateProvider, AuthenticationStateSerializer>());
Microsoft.AspNetCore.Cors (2)
CorsServiceCollectionExtensions.cs (2)
25services.TryAdd(ServiceDescriptor.Transient<ICorsService, CorsService>()); 26services.TryAdd(ServiceDescriptor.Transient<ICorsPolicyProvider, DefaultCorsPolicyProvider>());
Microsoft.AspNetCore.DataProtection (5)
DataProtectionBuilderExtensions.cs (1)
521builder.Services.Replace(ServiceDescriptor.Singleton<IDataProtectionProvider, EphemeralDataProtectionProvider>());
DataProtectionServiceCollectionExtensions.cs (4)
69ServiceDescriptor.Singleton<IConfigureOptions<KeyManagementOptions>, KeyManagementOptionsSetup>()); 71ServiceDescriptor.Singleton<IPostConfigureOptions<KeyManagementOptions>, KeyManagementOptionsPostSetup>()); 73ServiceDescriptor.Transient<IConfigureOptions<DataProtectionOptions>, DataProtectionOptionsSetup>()); 77services.TryAddEnumerable(ServiceDescriptor.Singleton<IHostedService, DataProtectionHostedService>());
Microsoft.AspNetCore.DataProtection.Tests (4)
HostingTests.cs (3)
33.Replace(ServiceDescriptor.Singleton(mockKeyRing.Object)) 59.Replace(ServiceDescriptor.Singleton(mockKeyRing.Object)) 88.Replace(ServiceDescriptor.Singleton(mockKeyRing.Object))
ServiceCollectionTests.cs (1)
59foreach (var descriptor in serviceCollection)
Microsoft.AspNetCore.Diagnostics.Middleware (2)
Latency\RequestLatencyTelemetryServiceCollectionExtensions.cs (1)
73services.TryAddEnumerable(ServiceDescriptor.Singleton<IStartupFilter, CapturePipelineEntryStartupFilter>());
Logging\HttpLoggingServiceCollectionExtensions.cs (1)
40services.TryAddEnumerable(ServiceDescriptor.Singleton<IHttpLoggingInterceptor, HttpLoggingRedactionInterceptor>());
Microsoft.AspNetCore.Grpc.JsonTranscoding (2)
GrpcJsonTranscodingServiceExtensions.cs (2)
28builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton(typeof(IServiceMethodProvider<>), typeof(JsonTranscodingServiceMethodProvider<>))); 29builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<GrpcJsonTranscodingOptions>, GrpcJsonTranscodingOptionsSetup>());
Microsoft.AspNetCore.Grpc.Swagger (2)
GrpcSwaggerServiceExtensions.cs (2)
33services.TryAddEnumerable(ServiceDescriptor.Transient<IApiDescriptionProvider, GrpcJsonTranscodingDescriptionProvider>()); 48services.Replace(ServiceDescriptor.Transient<ISerializerDataContractResolver>(s =>
Microsoft.AspNetCore.Hosting (5)
Internal\ServiceCollectionExtensions.cs (1)
13foreach (var service in serviceCollection)
WebHostBuilder.cs (3)
355services.Replace(ServiceDescriptor.Singleton(typeof(DiagnosticListener), listener!)); 356services.Replace(ServiceDescriptor.Singleton(typeof(DiagnosticSource), listener!)); 359services.Replace(ServiceDescriptor.Singleton(typeof(ActivitySource), activitySource!));
WebHostBuilderExtensions.cs (1)
205services.Replace(ServiceDescriptor.Singleton<IServiceProviderFactory<IServiceCollection>>(new DefaultServiceProviderFactory(options)));
Microsoft.AspNetCore.Hosting.Tests (4)
WebHostBuilderTests.cs (3)
1647internal ServiceDescriptor ServiceADescriptor { get; set; } 1684var heDescriptor = services.SingleOrDefault(s => s.ServiceType == typeof(IHostingEnvironment)); 1688var wheDescriptor = services.SingleOrDefault(s => s.ServiceType == typeof(IWebHostEnvironment));
WebHostTests.AsyncDisposable.cs (1)
17services.Add(ServiceDescriptor.Singleton<IServiceProviderFactory<IServiceCollection>>(providerFactory)
Microsoft.AspNetCore.Http.Connections (1)
ConnectionsDependencyInjectionExtensions.cs (1)
25services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<ConnectionOptions>, ConnectionOptionsSetup>());
Microsoft.AspNetCore.Http.Extensions (2)
ProblemDetailsServiceCollectionExtensions.cs (2)
42services.TryAddEnumerable(ServiceDescriptor.Singleton<IProblemDetailsWriter, DefaultProblemDetailsWriter>()); 44services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<JsonOptions>, ProblemDetailsJsonOptionsSetup>());
Microsoft.AspNetCore.Http.Extensions.Tests (2)
ProblemDetailsServiceCollectionExtensionsTest.cs (2)
56collection.TryAddEnumerable(ServiceDescriptor.Singleton(typeof(IProblemDetailsWriter), mockWriter)); 81var service = Assert.Single(collection, (sd) => sd.ServiceType == typeof(IProblemDetailsService));
Microsoft.AspNetCore.Http.Tests (1)
HttpServiceCollectionExtensionsTests.cs (1)
20var descriptor = services[0];
Microsoft.AspNetCore.HttpLogging (1)
HttpLoggingServicesExtensions.cs (1)
54services.TryAddEnumerable(ServiceDescriptor.Singleton<IHttpLoggingInterceptor, T>());
Microsoft.AspNetCore.Identity (3)
IdentityBuilderExtensions.cs (2)
46builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IPostConfigureOptions<SecurityStampValidatorOptions>, PostConfigureSecurityStampValidatorOptions>()); 102builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<JsonOptions>, IdentityEndpointsJsonOptionsSetup>());
IdentityServiceCollectionExtensions.cs (1)
101services.TryAddEnumerable(ServiceDescriptor.Singleton<IPostConfigureOptions<SecurityStampValidatorOptions>, PostConfigureSecurityStampValidatorOptions>());
Microsoft.AspNetCore.MiddlewareAnalysis (1)
AnalysisServiceCollectionExtensions.cs (1)
27services.TryAddEnumerable(ServiceDescriptor.Transient<IStartupFilter, AnalysisStartupFilter>());
Microsoft.AspNetCore.Mvc (2)
MvcServiceCollectionExtensions.cs (2)
146ServiceDescriptor.Singleton<IActionDescriptorChangeProvider, HotReloadService>()); 317ServiceDescriptor.Singleton<IActionDescriptorChangeProvider, HotReloadService>());
Microsoft.AspNetCore.Mvc.ApiExplorer (2)
DependencyInjection\EndpointMethodInfoApiExplorerServiceCollectionExtensions.cs (1)
31ServiceDescriptor.Transient<IApiDescriptionProvider, EndpointMetadataApiDescriptionProvider>());
DependencyInjection\MvcApiExplorerMvcCoreBuilderExtensions.cs (1)
40ServiceDescriptor.Transient<IApiDescriptionProvider, DefaultApiDescriptionProvider>());
Microsoft.AspNetCore.Mvc.Core (20)
DependencyInjection\MvcCoreMvcBuilderExtensions.cs (1)
132builder.Services.Replace(ServiceDescriptor.Transient<IControllerActivator, ServiceBasedControllerActivator>());
DependencyInjection\MvcCoreMvcCoreBuilderExtensions.cs (2)
131ServiceDescriptor.Transient<IApplicationModelProvider, AuthorizationApplicationModelProvider>()); 149builder.Services.Replace(ServiceDescriptor.Transient<IControllerActivator, ServiceBasedControllerActivator>());
DependencyInjection\MvcCoreServiceCollectionExtensions.cs (17)
135ServiceDescriptor.Transient<IConfigureOptions<MvcOptions>, MvcCoreMvcOptionsSetup>()); 137ServiceDescriptor.Transient<IPostConfigureOptions<MvcOptions>, MvcCoreMvcOptionsSetup>()); 139ServiceDescriptor.Transient<IConfigureOptions<ApiBehaviorOptions>, ApiBehaviorOptionsSetup>()); 141ServiceDescriptor.Transient<IConfigureOptions<RouteOptions>, MvcCoreRouteOptionsSetup>()); 149ServiceDescriptor.Transient<IApplicationModelProvider, DefaultApplicationModelProvider>()); 151ServiceDescriptor.Transient<IApplicationModelProvider, ApiBehaviorApplicationModelProvider>()); 153ServiceDescriptor.Transient<IActionDescriptorProvider, ControllerActionDescriptorProvider>()); 164services.TryAddEnumerable(ServiceDescriptor.Transient<IActionConstraintProvider, DefaultActionConstraintProvider>()); 167services.TryAddEnumerable(ServiceDescriptor.Singleton<MatcherPolicy, ActionConstraintMatcherPolicy>()); 181ServiceDescriptor.Transient<IControllerPropertyActivator, DefaultControllerPropertyActivator>()); 189ServiceDescriptor.Transient<IActionInvokerProvider, ControllerActionInvokerProvider>()); 194ServiceDescriptor.Singleton<IFilterProvider, DefaultFilterProvider>()); 209services.TryAdd(ServiceDescriptor.Transient<ICompositeMetadataDetailsProvider>(s => 263services.TryAddEnumerable(ServiceDescriptor.Singleton<MatcherPolicy, DynamicControllerEndpointMatcherPolicy>()); 264services.TryAddEnumerable(ServiceDescriptor.Singleton<IRequestDelegateFactory, ControllerRequestDelegateFactory>()); 273services.TryAddEnumerable(ServiceDescriptor.Singleton<IStartupFilter, MiddlewareFilterBuilderStartupFilter>()); 277services.TryAddEnumerable(ServiceDescriptor.Singleton<IProblemDetailsWriter, DefaultApiProblemDetailsWriter>());
Microsoft.AspNetCore.Mvc.Core.Test (6)
DependencyInjection\MvcCoreServiceCollectionExtensionsTest.cs (3)
40services.Add(ServiceDescriptor.Transient(serviceType.Key, mockType)); 68services.Add(ServiceDescriptor.Transient(serviceType, mockType)); 93foreach (var service in services)
Routing\ControllerLinkGeneratorExtensionsTest.cs (1)
220services.TryAddEnumerable(ServiceDescriptor.Singleton<EndpointDataSource>(new DefaultEndpointDataSource(endpoints)));
Routing\EndpointRoutingUrlHelperTest.cs (1)
287ServiceDescriptor.Singleton<EndpointDataSource>(new DefaultEndpointDataSource(endpoints)));
Routing\PageLinkGeneratorExtensionsTest.cs (1)
190services.TryAddEnumerable(ServiceDescriptor.Singleton<EndpointDataSource>(new DefaultEndpointDataSource(endpoints)));
Microsoft.AspNetCore.Mvc.Cors (1)
DependencyInjection\MvcCorsMvcCoreBuilderExtensions.cs (1)
71ServiceDescriptor.Transient<IApplicationModelProvider, CorsApplicationModelProvider>());
Microsoft.AspNetCore.Mvc.DataAnnotations (2)
DataAnnotationsLocalizationServices.cs (1)
25ServiceDescriptor.Transient
DependencyInjection\MvcDataAnnotationsMvcCoreBuilderExtensions.cs (1)
62ServiceDescriptor.Transient<IConfigureOptions<MvcOptions>, MvcDataAnnotationsMvcOptionsSetup>());
Microsoft.AspNetCore.Mvc.Formatters.Xml (4)
DependencyInjection\MvcXmlMvcBuilderExtensions.cs (2)
97ServiceDescriptor.Transient<IConfigureOptions<MvcOptions>, XmlDataContractSerializerMvcOptionsSetup>()); 104ServiceDescriptor.Transient<IConfigureOptions<MvcOptions>, XmlSerializerMvcOptionsSetup>());
DependencyInjection\MvcXmlMvcCoreBuilderExtensions.cs (2)
98ServiceDescriptor.Transient<IConfigureOptions<MvcOptions>, XmlDataContractSerializerMvcOptionsSetup>()); 105ServiceDescriptor.Transient<IConfigureOptions<MvcOptions>, XmlSerializerMvcOptionsSetup>());
Microsoft.AspNetCore.Mvc.FunctionalTests (2)
Infrastructure\MvcWebApplicationBuilderExtensions.cs (1)
34services.TryAddEnumerable(ServiceDescriptor.Singleton<IStartupFilter, CultureReplacerStartupFilter>());
TempDataInCookiesTest.cs (1)
44foreach (var serializer in tempDataSerializers)
Microsoft.AspNetCore.Mvc.Localization (3)
MvcLocalizationServices.cs (3)
41services.TryAdd(ServiceDescriptor.Singleton<IHtmlLocalizerFactory, HtmlLocalizerFactory>()); 42services.TryAdd(ServiceDescriptor.Transient(typeof(IHtmlLocalizer<>), typeof(HtmlLocalizer<>))); 43services.TryAdd(ServiceDescriptor.Transient<IViewLocalizer, ViewLocalizer>());
Microsoft.AspNetCore.Mvc.Localization.Test (7)
MvcLocalizationMvcBuilderExtensionsTest.cs (2)
46var service = services.FirstOrDefault( 125private ServiceDescriptor GetService(IServiceCollection services, Type serviceType)
MvcLocalizationMvcCoreBuilderExtensionsTest.cs (2)
46var service = services.FirstOrDefault( 125private ServiceDescriptor GetService(IServiceCollection services, Type serviceType)
MvcLocalizationServiceCollectionExtensionsTest.cs (3)
38collection.Add(ServiceDescriptor.Singleton(typeof(IHtmlLocalizerFactory), typeof(TestHtmlLocalizerFactory))); 39collection.Add(ServiceDescriptor.Transient(typeof(IHtmlLocalizer<>), typeof(TestHtmlLocalizer<>))); 40collection.Add(ServiceDescriptor.Transient(typeof(IViewLocalizer), typeof(TestViewLocalizer)));
Microsoft.AspNetCore.Mvc.NewtonsoftJson (5)
DependencyInjection\NewtonsoftJsonMvcCoreBuilderExtensions.cs (5)
60ServiceDescriptor.Transient<IConfigureOptions<MvcOptions>, NewtonsoftJsonMvcOptionsSetup>()); 62ServiceDescriptor.Transient<IApiDescriptionProvider, JsonPatchOperationsArrayProvider>()); 64var jsonResultExecutor = services.FirstOrDefault(f => 75var tempDataSerializer = services.FirstOrDefault(f => 89var jsonHelper = services.FirstOrDefault(
Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test (3)
DependencyInjection\NewtonsoftJsonMvcCoreBuilderExtensionsTest.cs (3)
44var jsonHelper = Assert.Single(services, d => d.ServiceType == typeof(IJsonHelper)); 59var tempDataSerializer = Assert.Single(services, d => d.ServiceType == typeof(TempDataSerializer)); 74var jsonResultExecutor = Assert.Single(services, d => d.ServiceType == typeof(IActionResultExecutor<JsonResult>));
Microsoft.AspNetCore.Mvc.Razor (3)
DependencyInjection\MvcRazorMvcCoreBuilderExtensions.cs (2)
126ServiceDescriptor.Transient<IConfigureOptions<MvcViewOptions>, MvcRazorMvcViewOptionsSetup>()); 129ServiceDescriptor.Transient<IConfigureOptions<RazorViewEngineOptions>, RazorViewEngineOptionsSetup>());
DependencyInjection\TagHelpersAsServices.cs (1)
27services.Replace(ServiceDescriptor.Transient<ITagHelperActivator, ServiceBasedTagHelperActivator>());
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation (7)
DependencyInjection\RazorRuntimeCompilationMvcCoreBuilderExtensions.cs (7)
58ServiceDescriptor.Transient<IConfigureOptions<MvcRazorRuntimeCompilationOptions>, MvcRazorRuntimeCompilationOptionsSetup>()); 60var compilerProvider = services.FirstOrDefault(f => 73var actionDescriptorProvider = services.FirstOrDefault(f => 86ServiceDescriptor.Singleton<IActionDescriptorProvider, PageActionDescriptorProvider>()); 87services.TryAddEnumerable(ServiceDescriptor.Singleton<MatcherPolicy, PageLoaderMatcherPolicy>()); 120ServiceDescriptor.Singleton<IPageRouteModelProvider, RazorProjectPageRouteModelProvider>()); 123ServiceDescriptor.Singleton<IActionDescriptorChangeProvider, PageActionDescriptorChangeProvider>());
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation.Test (2)
DependencyInjection\RazorRuntimeCompilationMvcCoreBuilderExtensionsTest.cs (2)
25var serviceDescriptor = Assert.Single(services, service => service.ServiceType == typeof(IViewCompilerProvider)); 40var serviceDescriptor = Assert.Single(services, service => service.ServiceType == typeof(IActionDescriptorProvider));
Microsoft.AspNetCore.Mvc.Razor.Test (8)
DependencyInjection\MvcRazorMvcBuilderExtensionsTest.cs (4)
28var activatorDescriptor = Assert.Single(services.ToList(), d => d.ServiceType == typeof(ITagHelperActivator)); 54var tagHelperOne = Assert.Single(collection, t => t.ServiceType == typeof(TestTagHelperOne)); 58var tagHelperTwo = Assert.Single(collection, t => t.ServiceType == typeof(TestTagHelperTwo)); 62var activator = Assert.Single(collection, t => t.ServiceType == typeof(ITagHelperActivator));
DependencyInjection\MvcRazorMvcCoreBuilderExtensionsTest.cs (4)
68var activatorDescriptor = Assert.Single(services.ToList(), d => d.ServiceType == typeof(ITagHelperActivator)); 94var tagHelperOne = Assert.Single(collection, t => t.ServiceType == typeof(TestTagHelperOne)); 98var tagHelperTwo = Assert.Single(collection, t => t.ServiceType == typeof(TestTagHelperTwo)); 102var activator = Assert.Single(collection, t => t.ServiceType == typeof(ITagHelperActivator));
Microsoft.AspNetCore.Mvc.RazorPages (15)
DependencyInjection\MvcRazorPagesMvcCoreBuilderExtensions.cs (15)
83ServiceDescriptor.Transient<IConfigureOptions<RazorViewEngineOptions>, RazorPagesRazorViewEngineOptionsSetup>()); 86ServiceDescriptor.Transient<IConfigureOptions<RazorPagesOptions>, RazorPagesOptionsSetup>()); 89services.TryAddEnumerable(ServiceDescriptor.Singleton<MatcherPolicy, DynamicPageEndpointMatcherPolicy>()); 94var actionDescriptorProvider = services.FirstOrDefault(f => 105ServiceDescriptor.Singleton<IActionDescriptorProvider, CompiledPageActionDescriptorProvider>()); 108ServiceDescriptor.Singleton<IPageRouteModelProvider, CompiledPageRouteModelProvider>()); 110services.TryAddEnumerable(ServiceDescriptor.Singleton<MatcherPolicy, DynamicPageEndpointMatcherPolicy>()); 113ServiceDescriptor.Singleton<IPageApplicationModelProvider, DefaultPageApplicationModelProvider>()); 115ServiceDescriptor.Singleton<IPageApplicationModelProvider, AutoValidateAntiforgeryPageApplicationModelProvider>()); 117ServiceDescriptor.Singleton<IPageApplicationModelProvider, AuthorizationPageApplicationModelProvider>()); 119ServiceDescriptor.Singleton<IPageApplicationModelProvider, TempDataFilterPageApplicationModelProvider>()); 121ServiceDescriptor.Singleton<IPageApplicationModelProvider, ViewDataAttributePageApplicationModelProvider>()); 123ServiceDescriptor.Singleton<IPageApplicationModelProvider, ResponseCacheFilterApplicationModelProvider>()); 128ServiceDescriptor.Singleton<IActionInvokerProvider, PageActionInvokerProvider>()); 130ServiceDescriptor.Singleton<IRequestDelegateFactory, PageRequestDelegateFactory>());
Microsoft.AspNetCore.Mvc.Test (9)
MvcServiceCollectionExtensionsTest.cs (9)
65services.Add(ServiceDescriptor.Transient(serviceType.Key, mockType)); 149services.Add(ServiceDescriptor.Transient(serviceType, mockType)); 264foreach (var service in services) 310var descriptor = Assert.Single(services, d => d.ServiceType == typeof(ApplicationPartManager)); 338var descriptor = Assert.Single(services, d => d.ServiceType == typeof(ApplicationPartManager)); 364var descriptor = Assert.Single(services, d => d.ServiceType == typeof(ApplicationPartManager)); 388var descriptor = Assert.Single(services, d => d.ServiceType == typeof(ApplicationPartManager)); 436var descriptor = Assert.Single(services, item => item.ServiceType == typeof(ITempDataProvider)); 648foreach ( var service in matches )
Microsoft.AspNetCore.Mvc.ViewFeatures (13)
DependencyInjection\MvcViewFeaturesMvcBuilderExtensions.cs (5)
53builder.Services.Replace(ServiceDescriptor.Singleton<IViewComponentActivator, ServiceBasedViewComponentActivator>()); 71var descriptor = ServiceDescriptor.Singleton(typeof(ITempDataProvider), typeof(SessionStateTempDataProvider)); 90var descriptor = ServiceDescriptor.Singleton(typeof(ITempDataProvider), typeof(CookieTempDataProvider));
DependencyInjection\MvcViewFeaturesMvcCoreBuilderExtensions.cs (8)
56var descriptor = ServiceDescriptor.Singleton(typeof(ITempDataProvider), typeof(CookieTempDataProvider)); 137ServiceDescriptor.Transient<IConfigureOptions<MvcViewOptions>, MvcViewOptionsSetup>()); 139ServiceDescriptor.Transient<IConfigureOptions<MvcOptions>, TempDataMvcOptionsSetup>()); 150ServiceDescriptor 188ServiceDescriptor.Transient<IApplicationModelProvider, TempDataApplicationModelProvider>()); 190ServiceDescriptor.Transient<IApplicationModelProvider, ViewDataAttributeApplicationModelProvider>()); 204ServiceDescriptor.Transient<IApplicationModelProvider, AntiforgeryApplicationModelProvider>());
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (13)
DependencyInjection\MvcViewFeaturesMvcBuilderExtensionsTest.cs (4)
45var descriptor = Assert.Single(builder.Services, item => item.ServiceType == typeof(ITempDataProvider)); 74var descriptor = Assert.Single(builder.Services, item => item.ServiceType == typeof(ITempDataProvider)); 104var descriptor = Assert.Single(builder.Services, item => item.ServiceType == typeof(ITempDataProvider)); 119var descriptor = Assert.Single(builder.Services, item => item.ServiceType == typeof(ITempDataProvider));
DependencyInjection\MvcViewFeaturesMvcCoreBuilderExtensionsTest.cs (9)
23var descriptor = Assert.Single(services, item => item.ServiceType == typeof(ITempDataProvider)); 38var descriptor = Assert.Single(services, item => item.ServiceType == typeof(ITempDataProvider)); 69var descriptor = Assert.Single(services, item => item.ServiceType == typeof(ITempDataProvider)); 101var descriptor = Assert.Single(services, item => item.ServiceType == typeof(ITempDataProvider)); 117var descriptor = Assert.Single(services, item => item.ServiceType == typeof(ITempDataProvider)); 133var descriptor = Assert.Single(services, item => item.ServiceType == typeof(ITempDataProvider)); 149var descriptor = Assert.Single(services, item => item.ServiceType == typeof(ITempDataProvider)); 165var descriptor = Assert.Single(services, item => item.ServiceType == typeof(ITempDataProvider)); 181var descriptor = Assert.Single(services, item => item.ServiceType == typeof(ITempDataProvider));
Microsoft.AspNetCore.OpenApi (1)
Extensions\OpenApiServiceCollectionExtensions.cs (1)
120services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<JsonOptions>, OpenApiSchemaJsonOptions>());
Microsoft.AspNetCore.Routing (8)
DependencyInjection\RoutingServiceCollectionExtensions.cs (8)
31services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<RouteOptions>, RegexInlineRouteConstraintSetup>()); 59services.TryAdd(ServiceDescriptor.Transient<TreeRouteBuilder>(s => 71services.TryAddEnumerable(ServiceDescriptor.Transient<IConfigureOptions<RouteOptions>, ConfigureRouteOptions>( 105services.TryAddEnumerable(ServiceDescriptor.Singleton<MatcherPolicy, HttpMethodMatcherPolicy>()); 106services.TryAddEnumerable(ServiceDescriptor.Singleton<MatcherPolicy, HostMatcherPolicy>()); 107services.TryAddEnumerable(ServiceDescriptor.Singleton<MatcherPolicy, AcceptsMatcherPolicy>()); 108services.TryAddEnumerable(ServiceDescriptor.Singleton<MatcherPolicy, ContentEncodingNegotiationMatcherPolicy>()); 118services.TryAddEnumerable(ServiceDescriptor.Transient<IConfigureOptions<RouteHandlerOptions>, ConfigureRouteHandlerOptions>());
Microsoft.AspNetCore.Routing.Microbenchmarks (1)
EndpointRoutingBenchmarkBase.cs (1)
35ServiceDescriptor.Singleton<EndpointDataSource>(new DefaultEndpointDataSource(Endpoints)));
Microsoft.AspNetCore.Server.Kestrel (2)
WebHostBuilderKestrelExtensions.cs (2)
134services.TryAddEnumerable(ServiceDescriptor.Transient<IConfigureOptions<KestrelServerOptions>, KestrelServerOptionsSetup>()); 170services.TryAddEnumerable(ServiceDescriptor.Transient<IConfigureOptions<KestrelServerOptions>, KestrelServerOptionsSetup>());
Microsoft.AspNetCore.SignalR (1)
SignalRDependencyInjectionExtensions.cs (1)
46services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<HubOptions>, HubOptionsSetup>());
Microsoft.AspNetCore.SignalR.Client.FunctionalTests (1)
VersionStartup.cs (1)
24services.TryAddEnumerable(ServiceDescriptor.Singleton<IHubProtocol>(new VersionedJsonHubProtocol(1000)));
Microsoft.AspNetCore.SignalR.Microbenchmarks (1)
HubConnectionReceiveBenchmark.cs (1)
72hubConnectionBuilder.Services.TryAddEnumerable(ServiceDescriptor.Singleton(typeof(IHubProtocol), hubProtocol));
Microsoft.AspNetCore.SignalR.Protocols.Json (1)
JsonProtocolDependencyInjectionExtensions.cs (1)
38builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IHubProtocol, JsonHubProtocol>());
Microsoft.AspNetCore.SignalR.Protocols.MessagePack (1)
MessagePackProtocolDependencyInjectionExtensions.cs (1)
41builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IHubProtocol, MessagePackHubProtocol>());
Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson (1)
NewtonsoftJsonProtocolDependencyInjectionExtensions.cs (1)
41builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IHubProtocol, NewtonsoftJsonHubProtocol>());
Microsoft.AspNetCore.SignalR.Tests (2)
AddSignalRTests.cs (2)
178serviceCollection.TryAddEnumerable(ServiceDescriptor.Singleton<IHubProtocol, CustomHubProtocol>()); 179serviceCollection.TryAddEnumerable(ServiceDescriptor.Singleton<IHubProtocol, MessagePackHubProtocol>());
Microsoft.AspNetCore.SpaProxy (1)
SpaHostingStartup.cs (1)
29services.TryAddEnumerable(ServiceDescriptor.Singleton<IStartupFilter, SpaProxyStartupFilter>());
Microsoft.AspNetCore.Tests (2)
WebApplicationTests.cs (2)
1821Assert.Throws<InvalidOperationException>(() => builder.Services.Remove(ServiceDescriptor.Singleton(new Service()))); 1822Assert.Throws<InvalidOperationException>(() => builder.Services[0] = ServiceDescriptor.Singleton(new Service()));
Microsoft.Authentication.WebAssembly.Msal (1)
MsalWebAssemblyServiceCollectionExtensions.cs (1)
61services.TryAddEnumerable(ServiceDescriptor.Scoped<IPostConfigureOptions<RemoteAuthenticationOptions<MsalProviderOptions>>, MsalDefaultOptionsConfiguration>());
Microsoft.DotNet.Internal.DependencyInjection.Testing (2)
DependencyInjectionValidation.cs (2)
50foreach (ServiceDescriptor service in services) 145ServiceDescriptor parameterService = services.FirstOrDefault(s => IsMatchingServiceRegistration(s.ServiceType, p.ParameterType));
Microsoft.Extensions.AI.Tests (6)
ChatCompletion\DependencyInjectionPatterns.cs (4)
125ServiceDescriptor sd = Assert.Single(sc); 147ServiceDescriptor sd = Assert.Single(sc); 171ServiceDescriptor sd = sc[0]; 216ServiceDescriptor sd = sc[0];
SpeechToText\SpeechToTextClientDependencyInjectionPatterns.cs (2)
125ServiceDescriptor sd = Assert.Single(sc); 147ServiceDescriptor sd = Assert.Single(sc);
Microsoft.Extensions.AsyncState.Tests (1)
AsyncContextServiceCollectionExtensionsTests.cs (1)
29var serviceDescriptor = services.First(x => x.ServiceType == typeof(IAsyncContext<>));
Microsoft.Extensions.Caching.Memory (2)
MemoryCacheServiceCollectionExtensions.cs (2)
27services.TryAdd(ServiceDescriptor.Singleton<IMemoryCache, MemoryCache>()); 71services.TryAdd(ServiceDescriptor.Singleton<IDistributedCache, MemoryDistributedCache>());
Microsoft.Extensions.Caching.SqlServer (1)
SqlServerCachingServicesExtensions.cs (1)
37services.Add(ServiceDescriptor.Singleton<IDistributedCache, SqlServerCache>());
Microsoft.Extensions.Caching.SqlServer.Tests (2)
SqlServerCacheServicesExtensionsTest.cs (2)
24var serviceDescriptor = Assert.Single(services); 48var distributedCache = services.FirstOrDefault(desc => desc.ServiceType == typeof(IDistributedCache));
Microsoft.Extensions.Caching.StackExchangeRedis (1)
StackExchangeRedisCacheServiceCollectionExtensions.cs (1)
32services.Add(ServiceDescriptor.Singleton<IDistributedCache, RedisCacheImpl>());
Microsoft.Extensions.Caching.StackExchangeRedis.Tests (3)
CacheServiceExtensionsTests.cs (3)
34var distributedCache = services.FirstOrDefault(desc => desc.ServiceType == typeof(IDistributedCache)); 53var distributedCache = services.FirstOrDefault(desc => desc.ServiceType == typeof(IDistributedCache)); 124var distributedCache = services.FirstOrDefault(desc => desc.ServiceType == typeof(IDistributedCache));
Microsoft.Extensions.Compliance.Redaction (4)
RedactionBuilder.cs (4)
29Services.TryAddEnumerable(ServiceDescriptor.Singleton<Redactor>(ErasingRedactor.Instance)); 30Services.TryAddEnumerable(ServiceDescriptor.Singleton<Redactor>(NullRedactor.Instance)); 41Services.TryAddEnumerable(ServiceDescriptor.Singleton(typeof(Redactor), redactorType)); 51Services.TryAddEnumerable(ServiceDescriptor.Singleton(typeof(Redactor), typeof(T)));
Microsoft.Extensions.DependencyInjection (34)
DependencyInjectionEventSource.cs (2)
183foreach (ServiceDescriptor descriptor in provider.CallSiteFactory.Descriptors) 239private static void AppendServiceDescriptor(StringBuilder builder, ServiceDescriptor descriptor)
ServiceLookup\CallSiteFactory.cs (17)
17private readonly ServiceDescriptor[] _descriptors; 24public CallSiteFactory(ICollection<ServiceDescriptor> descriptors) 27_descriptors = new ServiceDescriptor[descriptors.Count]; 33internal ServiceDescriptor[] Descriptors => _descriptors; 37foreach (ServiceDescriptor descriptor in _descriptors) 152internal int? GetSlot(ServiceDescriptor serviceDescriptor) 166internal ServiceCallSite? GetCallSite(ServiceDescriptor serviceDescriptor, CallSiteChain callSiteChain) 297ServiceDescriptor descriptor = descriptors[i]; 404private ServiceCallSite? TryCreateExact(ServiceDescriptor descriptor, ServiceIdentifier serviceIdentifier, CallSiteChain callSiteChain, int slot) 450private ServiceCallSite? TryCreateOpenGeneric(ServiceDescriptor descriptor, ServiceIdentifier serviceIdentifier, CallSiteChain callSiteChain, int slot, bool throwOnConstraintViolation) 737private ServiceDescriptor? _item; 740private List<ServiceDescriptor>? _items; 742public ServiceDescriptor Last 770public ServiceDescriptor this[int index] 788public int GetSlot(ServiceDescriptor descriptor) 807public ServiceDescriptorCacheItem Add(ServiceDescriptor descriptor) 818newCacheItem._items = _items ?? new List<ServiceDescriptor>();
ServiceLookup\ServiceDescriptorExtensions.cs (7)
11public static bool HasImplementationInstance(this ServiceDescriptor serviceDescriptor) => GetImplementationInstance(serviceDescriptor) != null; 13public static bool HasImplementationFactory(this ServiceDescriptor serviceDescriptor) => GetImplementationFactory(serviceDescriptor) != null; 15public static bool HasImplementationType(this ServiceDescriptor serviceDescriptor) => GetImplementationType(serviceDescriptor) != null; 17public static object? GetImplementationInstance(this ServiceDescriptor serviceDescriptor) 24public static object? GetImplementationFactory(this ServiceDescriptor serviceDescriptor) 32public static Type? GetImplementationType(this ServiceDescriptor serviceDescriptor) 39public static bool TryGetImplementationType(this ServiceDescriptor serviceDescriptor, out Type? type)
ServiceLookup\ServiceIdentifier.cs (1)
26public static ServiceIdentifier FromDescriptor(ServiceDescriptor serviceDescriptor)
ServiceLookup\ServiceProviderEngineScope.cs (2)
255public List<ServiceDescriptor> ServiceDescriptors => new List<ServiceDescriptor>(_serviceProvider.RootProvider.CallSiteFactory.Descriptors);
ServiceProvider.cs (5)
52internal ServiceProvider(ICollection<ServiceDescriptor> serviceDescriptors, ServiceProviderOptions options) 76foreach (ServiceDescriptor serviceDescriptor in serviceDescriptors) 219private void ValidateService(ServiceDescriptor descriptor) 315public List<ServiceDescriptor> ServiceDescriptors => new List<ServiceDescriptor>(_serviceProvider.Root.RootProvider.CallSiteFactory.Descriptors);
Microsoft.Extensions.DependencyInjection.Abstractions (268)
Extensions\ServiceCollectionDescriptorExtensions.cs (55)
19/// <param name="descriptor">The <see cref="ServiceDescriptor"/> to add.</param> 23ServiceDescriptor descriptor) 33/// Adds a sequence of <see cref="ServiceDescriptor"/> to the <paramref name="collection"/>. 36/// <param name="descriptors">The <see cref="ServiceDescriptor"/>s to add.</param> 40IEnumerable<ServiceDescriptor> descriptors) 45foreach (ServiceDescriptor? descriptor in descriptors) 58/// <param name="descriptor">The <see cref="ServiceDescriptor"/> to add.</param> 61ServiceDescriptor descriptor) 85/// <param name="descriptors">The <see cref="ServiceDescriptor"/>s to add.</param> 88IEnumerable<ServiceDescriptor> descriptors) 93foreach (ServiceDescriptor? d in descriptors) 112var descriptor = ServiceDescriptor.Transient(service, service); 133var descriptor = ServiceDescriptor.Transient(service, implementationType); 154var descriptor = ServiceDescriptor.Transient(service, implementationFactory); 202services.TryAdd(ServiceDescriptor.Transient(implementationFactory)); 218var descriptor = ServiceDescriptor.Scoped(service, service); 239var descriptor = ServiceDescriptor.Scoped(service, implementationType); 260var descriptor = ServiceDescriptor.Scoped(service, implementationFactory); 308services.TryAdd(ServiceDescriptor.Scoped(implementationFactory)); 324var descriptor = ServiceDescriptor.Singleton(service, service); 345var descriptor = ServiceDescriptor.Singleton(service, implementationType); 366var descriptor = ServiceDescriptor.Singleton(service, implementationFactory); 415var descriptor = ServiceDescriptor.Singleton(serviceType: typeof(TService), implementationInstance: instance); 432services.TryAdd(ServiceDescriptor.Singleton(implementationFactory)); 436/// Adds a <see cref="ServiceDescriptor"/> if an existing descriptor with the same 437/// <see cref="ServiceDescriptor.ServiceType"/> and an implementation that does not already exist 441/// <param name="descriptor">The <see cref="ServiceDescriptor"/>.</param> 443/// Use <see cref="TryAddEnumerable(IServiceCollection, ServiceDescriptor)"/> when registering a service implementation of a 446/// <see cref="Add(IServiceCollection, ServiceDescriptor)"/> is not idempotent and can add 448/// <see cref="ServiceDescriptor"/> instances if called twice. Using 449/// <see cref="TryAddEnumerable(IServiceCollection, ServiceDescriptor)"/> will prevent registration 454ServiceDescriptor descriptor) 474ServiceDescriptor service = services[i]; 488/// Adds the specified <see cref="ServiceDescriptor"/>s if an existing descriptor with the same 489/// <see cref="ServiceDescriptor.ServiceType"/> and an implementation that does not already exist 493/// <param name="descriptors">The <see cref="ServiceDescriptor"/>s.</param> 495/// Use <see cref="TryAddEnumerable(IServiceCollection, ServiceDescriptor)"/> when registering a service 498/// <see cref="Add(IServiceCollection, ServiceDescriptor)"/> is not idempotent and can add 500/// <see cref="ServiceDescriptor"/> instances if called twice. Using 501/// <see cref="TryAddEnumerable(IServiceCollection, ServiceDescriptor)"/> will prevent registration 506IEnumerable<ServiceDescriptor> descriptors) 511foreach (ServiceDescriptor? d in descriptors) 522/// <param name="descriptor">The <see cref="ServiceDescriptor"/> to replace with.</param> 526ServiceDescriptor descriptor) 568ServiceDescriptor? descriptor = collection[i];
Extensions\ServiceCollectionDescriptorExtensions.Keyed.cs (24)
27var descriptor = ServiceDescriptor.KeyedTransient(service, serviceKey, service); 50var descriptor = ServiceDescriptor.KeyedTransient(service, serviceKey, implementationType); 73var descriptor = ServiceDescriptor.KeyedTransient(service, serviceKey, implementationFactory); 125services.TryAdd(ServiceDescriptor.KeyedTransient(serviceKey, implementationFactory)); 143var descriptor = ServiceDescriptor.KeyedScoped(service, serviceKey, service); 166var descriptor = ServiceDescriptor.KeyedScoped(service, serviceKey, implementationType); 189var descriptor = ServiceDescriptor.KeyedScoped(service, serviceKey, implementationFactory); 241services.TryAdd(ServiceDescriptor.KeyedScoped(serviceKey, implementationFactory)); 259var descriptor = ServiceDescriptor.KeyedSingleton(service, serviceKey, service); 282var descriptor = ServiceDescriptor.KeyedSingleton(service, serviceKey, implementationType); 305var descriptor = ServiceDescriptor.KeyedSingleton(service, serviceKey, implementationFactory); 357var descriptor = ServiceDescriptor.KeyedSingleton(serviceType: typeof(TService), serviceKey, implementationInstance: instance); 376services.TryAdd(ServiceDescriptor.KeyedSingleton(serviceKey, implementationFactory)); 403ServiceDescriptor? descriptor = collection[i];
IKeyedServiceProvider.cs (1)
28/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param>
IServiceCollection.cs (1)
11public interface IServiceCollection : IList<ServiceDescriptor>
IServiceProviderIsKeyedService.cs (1)
19/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param>
ServiceCollection.cs (14)
18private readonly List<ServiceDescriptor> _descriptors = new List<ServiceDescriptor>(); 28public ServiceDescriptor this[int index] 49public bool Contains(ServiceDescriptor item) 55public void CopyTo(ServiceDescriptor[] array, int arrayIndex) 61public bool Remove(ServiceDescriptor item) 68public IEnumerator<ServiceDescriptor> GetEnumerator() 73void ICollection<ServiceDescriptor>.Add(ServiceDescriptor item) 85public int IndexOf(ServiceDescriptor item) 91public void Insert(int index, ServiceDescriptor item) 146public ServiceDescriptor[] Items 150ServiceDescriptor[] items = new ServiceDescriptor[_services.Count];
ServiceCollectionServiceExtensions.cs (3)
460var serviceDescriptor = new ServiceDescriptor(serviceType, implementationInstance); 491var descriptor = new ServiceDescriptor(serviceType, implementationType, lifetime); 502var descriptor = new ServiceDescriptor(serviceType, implementationFactory, lifetime);
ServiceCollectionServiceExtensions.Keyed.cs (26)
21/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 45/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 70/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 90/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 110/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 130/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 155/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 179/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 203/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 228/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 248/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 268/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 288/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 313/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 337/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 361/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 386/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 406/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 426/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 446/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 471/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 495/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 509var serviceDescriptor = new ServiceDescriptor(serviceType, serviceKey, implementationInstance); 520/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 543var descriptor = new ServiceDescriptor(serviceType, serviceKey, implementationType, lifetime); 555var descriptor = new ServiceDescriptor(serviceType, serviceKey, implementationFactory, lifetime);
ServiceDescriptor.cs (143)
18/// Initializes a new instance of <see cref="ServiceDescriptor"/> with the specified <paramref name="implementationType"/>. 32/// Initializes a new instance of <see cref="ServiceDescriptor"/> with the specified <paramref name="implementationType"/>. 35/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 52/// Initializes a new instance of <see cref="ServiceDescriptor"/> with the specified <paramref name="instance"/> 65/// Initializes a new instance of <see cref="ServiceDescriptor"/> with the specified <paramref name="instance"/> 69/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 84/// Initializes a new instance of <see cref="ServiceDescriptor"/> with the specified <paramref name="factory"/>. 102/// Initializes a new instance of <see cref="ServiceDescriptor"/> with the specified <paramref name="factory"/>. 105/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 353/// Creates an instance of <see cref="ServiceDescriptor"/> with the specified 359/// <returns>A new instance of <see cref="ServiceDescriptor"/>.</returns> 360public static ServiceDescriptor Transient<TService, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TImplementation>() 368/// Creates an instance of <see cref="ServiceDescriptor"/> with the specified 374/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 375/// <returns>A new instance of <see cref="ServiceDescriptor"/>.</returns> 376public static ServiceDescriptor KeyedTransient<TService, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TImplementation>(object? serviceKey) 384/// Creates an instance of <see cref="ServiceDescriptor"/> with the specified 390/// <returns>A new instance of <see cref="ServiceDescriptor"/>.</returns> 391public static ServiceDescriptor Transient( 402/// Creates an instance of <see cref="ServiceDescriptor"/> with the specified 407/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 409/// <returns>A new instance of <see cref="ServiceDescriptor"/>.</returns> 410public static ServiceDescriptor KeyedTransient( 422/// Creates an instance of <see cref="ServiceDescriptor"/> with the specified 430/// <returns>A new instance of <see cref="ServiceDescriptor"/>.</returns> 431public static ServiceDescriptor Transient<TService, TImplementation>( 442/// Creates an instance of <see cref="ServiceDescriptor"/> with the specified 449/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 451/// <returns>A new instance of <see cref="ServiceDescriptor"/>.</returns> 452public static ServiceDescriptor KeyedTransient<TService, TImplementation>( 464/// Creates an instance of <see cref="ServiceDescriptor"/> with the specified 470/// <returns>A new instance of <see cref="ServiceDescriptor"/>.</returns> 471public static ServiceDescriptor Transient<TService>(Func<IServiceProvider, TService> implementationFactory) 480/// Creates an instance of <see cref="ServiceDescriptor"/> with the specified 485/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 487/// <returns>A new instance of <see cref="ServiceDescriptor"/>.</returns> 488public static ServiceDescriptor KeyedTransient<TService>(object? serviceKey, Func<IServiceProvider, object?, TService> implementationFactory) 497/// Creates an instance of <see cref="ServiceDescriptor"/> with the specified 503/// <returns>A new instance of <see cref="ServiceDescriptor"/>.</returns> 504public static ServiceDescriptor Transient(Type service, Func<IServiceProvider, object> implementationFactory) 513/// Creates an instance of <see cref="ServiceDescriptor"/> with the specified 518/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 520/// <returns>A new instance of <see cref="ServiceDescriptor"/>.</returns> 521public static ServiceDescriptor KeyedTransient(Type service, object? serviceKey, Func<IServiceProvider, object?, object> implementationFactory) 530/// Creates an instance of <see cref="ServiceDescriptor"/> with the specified 536/// <returns>A new instance of <see cref="ServiceDescriptor"/>.</returns> 537public static ServiceDescriptor Scoped<TService, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TImplementation>() 545/// Creates an instance of <see cref="ServiceDescriptor"/> with the specified 551/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 552/// <returns>A new instance of <see cref="ServiceDescriptor"/>.</returns> 553public static ServiceDescriptor KeyedScoped<TService, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TImplementation>(object? serviceKey) 561/// Creates an instance of <see cref="ServiceDescriptor"/> with the specified 567/// <returns>A new instance of <see cref="ServiceDescriptor"/>.</returns> 568public static ServiceDescriptor Scoped( 576/// Creates an instance of <see cref="ServiceDescriptor"/> with the specified 581/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 583/// <returns>A new instance of <see cref="ServiceDescriptor"/>.</returns> 584public static ServiceDescriptor KeyedScoped( 593/// Creates an instance of <see cref="ServiceDescriptor"/> with the specified 601/// <returns>A new instance of <see cref="ServiceDescriptor"/>.</returns> 602public static ServiceDescriptor Scoped<TService, TImplementation>( 613/// Creates an instance of <see cref="ServiceDescriptor"/> with the specified 620/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 622/// <returns>A new instance of <see cref="ServiceDescriptor"/>.</returns> 623public static ServiceDescriptor KeyedScoped<TService, TImplementation>( 635/// Creates an instance of <see cref="ServiceDescriptor"/> with the specified 641/// <returns>A new instance of <see cref="ServiceDescriptor"/>.</returns> 642public static ServiceDescriptor Scoped<TService>(Func<IServiceProvider, TService> implementationFactory) 651/// Creates an instance of <see cref="ServiceDescriptor"/> with the specified 656/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 658/// <returns>A new instance of <see cref="ServiceDescriptor"/>.</returns> 659public static ServiceDescriptor KeyedScoped<TService>(object? serviceKey, Func<IServiceProvider, object?, TService> implementationFactory) 668/// Creates an instance of <see cref="ServiceDescriptor"/> with the specified 674/// <returns>A new instance of <see cref="ServiceDescriptor"/>.</returns> 675public static ServiceDescriptor Scoped(Type service, Func<IServiceProvider, object> implementationFactory) 684/// Creates an instance of <see cref="ServiceDescriptor"/> with the specified 689/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 691/// <returns>A new instance of <see cref="ServiceDescriptor"/>.</returns> 692public static ServiceDescriptor KeyedScoped(Type service, object? serviceKey, Func<IServiceProvider, object?, object> implementationFactory) 701/// Creates an instance of <see cref="ServiceDescriptor"/> with the specified 707/// <returns>A new instance of <see cref="ServiceDescriptor"/>.</returns> 708public static ServiceDescriptor Singleton<TService, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TImplementation>() 716/// Creates an instance of <see cref="ServiceDescriptor"/> with the specified 722/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 723/// <returns>A new instance of <see cref="ServiceDescriptor"/>.</returns> 724public static ServiceDescriptor KeyedSingleton<TService, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TImplementation>( 733/// Creates an instance of <see cref="ServiceDescriptor"/> with the specified 739/// <returns>A new instance of <see cref="ServiceDescriptor"/>.</returns> 740public static ServiceDescriptor Singleton( 751/// Creates an instance of <see cref="ServiceDescriptor"/> with the specified 756/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 758/// <returns>A new instance of <see cref="ServiceDescriptor"/>.</returns> 759public static ServiceDescriptor KeyedSingleton( 771/// Creates an instance of <see cref="ServiceDescriptor"/> with the specified 779/// <returns>A new instance of <see cref="ServiceDescriptor"/>.</returns> 780public static ServiceDescriptor Singleton<TService, TImplementation>( 791/// Creates an instance of <see cref="ServiceDescriptor"/> with the specified 798/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 800/// <returns>A new instance of <see cref="ServiceDescriptor"/>.</returns> 801public static ServiceDescriptor KeyedSingleton<TService, TImplementation>( 813/// Creates an instance of <see cref="ServiceDescriptor"/> with the specified 819/// <returns>A new instance of <see cref="ServiceDescriptor"/>.</returns> 820public static ServiceDescriptor Singleton<TService>(Func<IServiceProvider, TService> implementationFactory) 829/// Creates an instance of <see cref="ServiceDescriptor"/> with the specified 834/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 836/// <returns>A new instance of <see cref="ServiceDescriptor"/>.</returns> 837public static ServiceDescriptor KeyedSingleton<TService>( 848/// Creates an instance of <see cref="ServiceDescriptor"/> with the specified 854/// <returns>A new instance of <see cref="ServiceDescriptor"/>.</returns> 855public static ServiceDescriptor Singleton( 866/// Creates an instance of <see cref="ServiceDescriptor"/> with the specified 871/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 873/// <returns>A new instance of <see cref="ServiceDescriptor"/>.</returns> 874public static ServiceDescriptor KeyedSingleton( 886/// Creates an instance of <see cref="ServiceDescriptor"/> with the specified 892/// <returns>A new instance of <see cref="ServiceDescriptor"/>.</returns> 893public static ServiceDescriptor Singleton<TService>(TService implementationInstance) 902/// Creates an instance of <see cref="ServiceDescriptor"/> with the specified 907/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 909/// <returns>A new instance of <see cref="ServiceDescriptor"/>.</returns> 910public static ServiceDescriptor KeyedSingleton<TService>( 921/// Creates an instance of <see cref="ServiceDescriptor"/> with the specified 927/// <returns>A new instance of <see cref="ServiceDescriptor"/>.</returns> 928public static ServiceDescriptor Singleton( 939/// Creates an instance of <see cref="ServiceDescriptor"/> with the specified 944/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 946/// <returns>A new instance of <see cref="ServiceDescriptor"/>.</returns> 947public static ServiceDescriptor KeyedSingleton( 958private static ServiceDescriptor DescribeKeyed<TService, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TImplementation>( 972/// Creates an instance of <see cref="ServiceDescriptor"/> with the specified 979/// <returns>A new instance of <see cref="ServiceDescriptor"/>.</returns> 980public static ServiceDescriptor Describe( 989/// Creates an instance of <see cref="ServiceDescriptor"/> with the specified 994/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 997/// <returns>A new instance of <see cref="ServiceDescriptor"/>.</returns> 998public static ServiceDescriptor DescribeKeyed( 1008/// Creates an instance of <see cref="ServiceDescriptor"/> with the specified 1015/// <returns>A new instance of <see cref="ServiceDescriptor"/>.</returns> 1016public static ServiceDescriptor Describe(Type serviceType, Func<IServiceProvider, object> implementationFactory, ServiceLifetime lifetime) 1022/// Creates an instance of <see cref="ServiceDescriptor"/> with the specified 1027/// <param name="serviceKey">The <see cref="ServiceDescriptor.ServiceKey"/> of the service.</param> 1030/// <returns>A new instance of <see cref="ServiceDescriptor"/>.</returns> 1031public static ServiceDescriptor DescribeKeyed(Type serviceType, object? serviceKey, Func<IServiceProvider, object?, object> implementationFactory, ServiceLifetime lifetime)
Microsoft.Extensions.DependencyInjection.AutoActivation (16)
AutoActivationExtensions.cs (8)
235services.TryAddAndActivate(ServiceDescriptor.Singleton(serviceType, serviceType)); 253services.TryAddAndActivate(ServiceDescriptor.Singleton(serviceType, implementationType)); 268services.TryAddAndActivate(ServiceDescriptor.Singleton(serviceType, implementationFactory)); 281services.TryAddAndActivate<TService>(ServiceDescriptor.Singleton<TService, TService>()); 296services.TryAddAndActivate<TService>(ServiceDescriptor.Singleton<TService, TImplementation>()); 311services.TryAddAndActivate<TService>(ServiceDescriptor.Singleton<TService>(implementationFactory)); 314private static void TryAddAndActivate<TService>(this IServiceCollection services, ServiceDescriptor descriptor) 326private static void TryAddAndActivate(this IServiceCollection services, ServiceDescriptor descriptor)
AutoActivationExtensions.Keyed.cs (8)
252services.TryAddAndActivateKeyed(ServiceDescriptor.KeyedSingleton(serviceType, serviceKey, serviceType)); 272services.TryAddAndActivateKeyed(ServiceDescriptor.KeyedSingleton(serviceType, serviceKey, implementationType)); 292services.TryAddAndActivateKeyed(ServiceDescriptor.KeyedSingleton(serviceType, serviceKey, implementationFactory)); 308services.TryAddAndActivateKeyed<TService>(ServiceDescriptor.KeyedSingleton<TService, TService>(serviceKey)); 326services.TryAddAndActivateKeyed<TService>(ServiceDescriptor.KeyedSingleton<TService, TImplementation>(serviceKey)); 345services.TryAddAndActivateKeyed<TService>(ServiceDescriptor.KeyedSingleton<TService>(serviceKey, implementationFactory)); 348private static void TryAddAndActivateKeyed<TService>(this IServiceCollection services, ServiceDescriptor descriptor) 360private static void TryAddAndActivateKeyed(this IServiceCollection services, ServiceDescriptor descriptor)
Microsoft.Extensions.Diagnostics.Abstractions (2)
Metrics\MetricsBuilderExtensions.Listeners.cs (2)
25builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IMetricsListener, T>()); 38builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton(listener));
Microsoft.Extensions.Diagnostics.ExceptionSummarization (1)
ExceptionSummarizationBuilder.cs (1)
22Services.TryAddEnumerable(ServiceDescriptor.Singleton<IExceptionSummaryProvider, T>());
Microsoft.Extensions.Diagnostics.HealthChecks (1)
DependencyInjection\HealthCheckServiceCollectionExtensions.cs (1)
29services.TryAddEnumerable(ServiceDescriptor.Singleton<IHostedService, HealthCheckPublisherHostedService>());
Microsoft.Extensions.Diagnostics.ResourceMonitoring (2)
ResourceMonitorBuilder.cs (2)
20services.TryAddEnumerable(ServiceDescriptor.Singleton<IHostedService, ResourceMonitorService>(static sp => sp.GetRequiredService<ResourceMonitorService>())); 32Services.TryAddEnumerable(ServiceDescriptor.Singleton<IResourceUtilizationPublisher, T>());
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests (4)
Linux\AcceptanceTest.cs (4)
127.Replace(ServiceDescriptor.Singleton<ILinuxUtilizationParser, LinuxUtilizationParserCgroupV1>()) 175.Replace(ServiceDescriptor.Singleton<ILinuxUtilizationParser, LinuxUtilizationParserCgroupV2>()) 317.Replace(ServiceDescriptor.Singleton<ILinuxUtilizationParser, LinuxUtilizationParserCgroupV2>())) 405.Replace(ServiceDescriptor.Singleton<ILinuxUtilizationParser, LinuxUtilizationParserCgroupV2>()))
Microsoft.Extensions.Diagnostics.Testing (2)
Logging\FakeLoggerBuilderExtensions.cs (2)
30builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<ILoggerProvider, FakeLoggerProvider>()); 48builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<ILoggerProvider, FakeLoggerProvider>());
Microsoft.Extensions.Hosting.Abstractions (2)
ServiceCollectionHostedServiceExtensions.cs (2)
25services.TryAddEnumerable(ServiceDescriptor.Singleton<IHostedService, THostedService>()); 40services.TryAddEnumerable(ServiceDescriptor.Singleton<IHostedService>(implementationFactory));
Microsoft.Extensions.Http (19)
DependencyInjection\DefaultHttpClientBuilderServiceCollection.cs (8)
25public void Add(ServiceDescriptor item) 59public ServiceDescriptor this[int index] 67public bool Contains(ServiceDescriptor item) => _services.Contains(item); 68public void CopyTo(ServiceDescriptor[] array, int arrayIndex) => _services.CopyTo(array, arrayIndex); 69public IEnumerator<ServiceDescriptor> GetEnumerator() => _services.GetEnumerator(); 70public int IndexOf(ServiceDescriptor item) => _services.IndexOf(item); 71public void Insert(int index, ServiceDescriptor item) => _services.Insert(index, item); 72public bool Remove(ServiceDescriptor item) => _services.Remove(item);
DependencyInjection\DefaultHttpClientConfigurationTracker.cs (1)
8public ServiceDescriptor? InsertDefaultsAfterDescriptor { get; set; }
DependencyInjection\HttpClientFactoryServiceCollectionExtensions.cs (4)
47services.TryAdd(ServiceDescriptor.Transient(typeof(ITypedHttpClientFactory<>), typeof(DefaultTypedHttpClientFactory<>))); 48services.TryAdd(ServiceDescriptor.Singleton(typeof(DefaultTypedHttpClientFactory<>.Cache), typeof(DefaultTypedHttpClientFactory<>.Cache))); 53services.TryAddEnumerable(ServiceDescriptor.Singleton<IHttpMessageHandlerBuilderFilter, LoggingHttpMessageHandlerBuilderFilter>()); 55services.TryAddEnumerable(ServiceDescriptor.Singleton<IHttpMessageHandlerBuilderFilter, MetricsFactoryHttpMessageHandlerFilter>());
DependencyInjection\HttpClientKeyedLifetime.cs (6)
15public ServiceDescriptor Client { get; } 16public ServiceDescriptor Handler { get; } 20private HttpClientKeyedLifetime(object serviceKey, ServiceDescriptor client, ServiceDescriptor handler) 31Client = ServiceDescriptor.DescribeKeyed(typeof(HttpClient), ServiceKey, CreateKeyedClient, lifetime); 32Handler = ServiceDescriptor.DescribeKeyed(typeof(HttpMessageHandler), ServiceKey, CreateKeyedHandler, lifetime);
Microsoft.Extensions.Http.Diagnostics.PerformanceTests (6)
HttpClientFactory.cs (6)
18services.TryAddEnumerable(ServiceDescriptor.Singleton<ILoggerProvider, DropMessageLoggerProvider>()); 42services.TryAddEnumerable(ServiceDescriptor.Singleton<ILoggerProvider, DropMessageLoggerProvider>()); 65services.TryAddEnumerable(ServiceDescriptor.Singleton<ILoggerProvider, DropMessageLoggerProvider>()); 92services.TryAddEnumerable(ServiceDescriptor.Singleton<ILoggerProvider, DropMessageLoggerProvider>()); 115services.TryAddEnumerable(ServiceDescriptor.Singleton<ILoggerProvider, DropMessageLoggerProvider>()); 138services.TryAddEnumerable(ServiceDescriptor.Singleton<ILoggerProvider, DropMessageLoggerProvider>());
Microsoft.Extensions.Http.Polly (3)
DependencyInjection\PollyServiceCollectionExtensions.cs (3)
39services.TryAddEnumerable(ServiceDescriptor.Singleton<IPolicyRegistry<string>>(registry)); 40services.TryAddEnumerable(ServiceDescriptor.Singleton<IReadOnlyPolicyRegistry<string>>(registry)); 44services.TryAddEnumerable(ServiceDescriptor.Singleton<IConcurrentPolicyRegistry<string>>(concurrentRegistry));
Microsoft.Extensions.Http.Resilience (2)
Resilience\ResilienceHttpClientBuilderExtensions.Resilience.cs (2)
174public static readonly ServiceDescriptor ServiceDescriptor = ServiceDescriptor.Singleton<Marker, Marker>();
Microsoft.Extensions.Logging (4)
LoggingBuilderExtensions.cs (1)
24builder.Services.Add(ServiceDescriptor.Singleton<IConfigureOptions<LoggerFilterOptions>>(
LoggingServiceCollectionExtensions.cs (3)
38services.TryAdd(ServiceDescriptor.Singleton<ILoggerFactory, LoggerFactory>()); 39services.TryAdd(ServiceDescriptor.Singleton(typeof(ILogger<>), typeof(Logger<>))); 41services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<LoggerFilterOptions>>(
Microsoft.Extensions.Logging.AzureAppServices (2)
AzureAppServicesLoggerFactoryExtensions.cs (2)
11using static Microsoft.Extensions.DependencyInjection.ServiceDescriptor; 90private static bool TryAddEnumerable(IServiceCollection collection, ServiceDescriptor descriptor)
Microsoft.Extensions.Logging.Configuration (2)
LoggerProviderConfigurationExtensions.cs (2)
29services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<TOptions>, LoggerProviderConfigureOptions<TOptions, TProvider>>()); 30services.TryAddEnumerable(ServiceDescriptor.Singleton<IOptionsChangeTokenSource<TOptions>, LoggerProviderOptionsChangeTokenSource<TOptions, TProvider>>());
Microsoft.Extensions.Logging.Console (6)
ConsoleLoggerExtensions.cs (6)
37builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<ILoggerProvider, ConsoleLoggerProvider>()); 39builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<ConsoleLoggerOptions>, ConsoleLoggerConfigureOptions>()); 40builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IOptionsChangeTokenSource<ConsoleLoggerOptions>, LoggerProviderOptionsChangeTokenSource<ConsoleLoggerOptions, ConsoleLoggerProvider>>()); 163builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<ConsoleFormatter, TFormatter>()); 164builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<TOptions>, TConfigureOptions>()); 165builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IOptionsChangeTokenSource<TOptions>, ConsoleLoggerFormatterOptionsChangeTokenSource<TFormatter, TOptions>>());
Microsoft.Extensions.Logging.Debug (1)
DebugLoggerFactoryExtensions.cs (1)
53builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<ILoggerProvider, DebugLoggerProvider>());
Microsoft.Extensions.Logging.EventLog (2)
EventLoggerFactoryExtensions.cs (2)
60builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<ILoggerProvider, EventLogLoggerProvider>()); 76builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<ILoggerProvider>(new EventLogLoggerProvider(settings)));
Microsoft.Extensions.Logging.EventSource (3)
EventSourceLoggerFactoryExtensions.cs (3)
44builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<ILoggerProvider, EventSourceLoggerProvider>()); 45builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IConfigureOptions<LoggerFilterOptions>, EventLogFiltersConfigureOptions>()); 46builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IOptionsChangeTokenSource<LoggerFilterOptions>, EventLogFiltersConfigureOptionsChangeSource>());
Microsoft.Extensions.ML (1)
ServiceCollectionExtensions.cs (1)
83.TryAddEnumerable(ServiceDescriptor.Singleton<IPostConfigureOptions<MLOptions>, PostMLContextOptionsConfiguration>());
Microsoft.Extensions.Options (6)
OptionsServiceCollectionExtensions.cs (6)
26services.TryAdd(ServiceDescriptor.Singleton(typeof(IOptions<>), typeof(UnnamedOptionsManager<>))); 27services.TryAdd(ServiceDescriptor.Scoped(typeof(IOptionsSnapshot<>), typeof(OptionsManager<>))); 28services.TryAdd(ServiceDescriptor.Singleton(typeof(IOptionsMonitor<>), typeof(OptionsMonitor<>))); 29services.TryAdd(ServiceDescriptor.Transient(typeof(IOptionsFactory<>), typeof(OptionsFactory<>))); 30services.TryAdd(ServiceDescriptor.Singleton(typeof(IOptionsMonitorCache<>), typeof(OptionsCache<>))); 72services.AddOptions().TryAddEnumerable(ServiceDescriptor.Singleton<IValidateOptions<TOptions>, TValidateOptions>());
Microsoft.Extensions.Options.Contextual (3)
ContextualOptionsServiceCollectionExtensions.cs (3)
29services.TryAdd(ServiceDescriptor.Singleton(typeof(IContextualOptionsFactory<>), typeof(ContextualOptionsFactory<>))); 30services.TryAdd(ServiceDescriptor.Singleton(typeof(IContextualOptions<,>), typeof(ContextualOptions<,>))); 31services.TryAdd(ServiceDescriptor.Singleton(typeof(INamedContextualOptions<,>), typeof(ContextualOptions<,>)));
Microsoft.Extensions.ServiceDiscovery (1)
ServiceDiscoveryHttpClientBuilderExtensions.cs (1)
49services.TryAddEnumerable(ServiceDescriptor.Singleton<IHttpMessageHandlerBuilderFilter, DisableGrpcLoadBalancingFilter>());
Microsoft.Extensions.Telemetry (3)
Logging\LoggingEnrichmentExtensions.cs (1)
72services.TryAddEnumerable(ServiceDescriptor.Singleton<ILoggerFactory, ExtendedLoggerFactory>());
Sampling\SamplingLoggerBuilderExtensions.cs (2)
132builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<ILoggerFactory, ExtendedLoggerFactory>()); 150builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<ILoggerFactory, ExtendedLoggerFactory>());
Microsoft.Maui (26)
Hosting\Dispatching\AppHostBuilderExtensions.cs (2)
22 builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<IMauiInitializeService, ApplicationDispatcherInitializer>()); 27 builder.Services.TryAddEnumerable(ServiceDescriptor.Scoped<IMauiInitializeScopedService, DispatcherInitializer>());
Hosting\EssentialsMauiAppBuilderExtensions.cs (1)
91 builder.Services.TryAddEnumerable(ServiceDescriptor.Transient<IMauiInitializeService, EssentialsInitializer>());
Hosting\Fonts\FontsMauiAppBuilderExtensions.cs (1)
38 builder.Services.TryAddEnumerable(ServiceDescriptor.Transient<IMauiInitializeService, FontInitializer>());
Hosting\IMauiServiceCollection.cs (1)
9 bool TryGetService(Type serviceType, out ServiceDescriptor? descriptor);
Hosting\Internal\MauiFactory.cs (4)
17 readonly ConcurrentDictionary<ServiceDescriptor, object?> _singletons; 22 _singletons = new ConcurrentDictionary<ServiceDescriptor, object?>(); 33 if (!_collection.TryGetService(serviceType, out ServiceDescriptor? descriptor) || descriptor == null) 50 object? CreateInstance(ServiceDescriptor item)
Hosting\Internal\MauiHandlersFactory.cs (1)
31 InternalCollection.TryGetService(GetVirtualViewHandlerServiceType(iview), out ServiceDescriptor? serviceDescriptor);
Hosting\Internal\MauiServiceCollection.cs (14)
11 readonly List<ServiceDescriptor> _descriptors = new List<ServiceDescriptor>(); 12 readonly Dictionary<Type, ServiceDescriptor> _descriptorDictionary = new Dictionary<Type, ServiceDescriptor>(); 18 public ServiceDescriptor this[int index] 24 public void Add(ServiceDescriptor item) 39 public bool Contains(ServiceDescriptor item) => 42 public IEnumerator<ServiceDescriptor> GetEnumerator() => 48 public bool Remove(ServiceDescriptor item) 56 public void CopyTo(ServiceDescriptor[] array, int arrayIndex) => 59 public int IndexOf(ServiceDescriptor item) => _descriptors.IndexOf(item); 61 public void Insert(int index, ServiceDescriptor item) 69 var descriptor = _descriptors[index]; 74 public bool TryGetService(Type serviceType, out ServiceDescriptor? descriptor) =>
Hosting\MauiAppBuilder.cs (2)
179 Services.TryAdd(ServiceDescriptor.Singleton<ILoggerFactory, NullLoggerFactory>()); 180 Services.TryAdd(ServiceDescriptor.Singleton(typeof(ILogger<>), typeof(NullLogger<>)));
Microsoft.Maui.Controls.Compatibility (1)
AppHostBuilderExtensions.cs (1)
117 builder.Services.TryAddEnumerable(ServiceDescriptor.Transient<IMauiInitializeService, MauiCompatInitializer>());
Microsoft.ML.AutoML (2)
AutoMLExperiment\AutoMLExperiment.cs (2)
177var descriptor = ServiceDescriptor.Singleton<ITuner>(factory);
Mvc.RoutingWebSite (1)
StartupWithoutEndpointRouting.cs (1)
86services.TryAddEnumerable(ServiceDescriptor.Singleton<IActionDescriptorProvider>(actionDescriptorProvider));