27 instantiations of ServiceDescriptor
Aspire.Azure.Npgsql.EntityFrameworkCore.PostgreSQL (1)
Aspire.Microsoft.EntityFrameworkCore.Cosmos (1)
Aspire.Microsoft.EntityFrameworkCore.SqlServer (1)
Aspire.Npgsql.EntityFrameworkCore.PostgreSQL (1)
Aspire.Oracle.EntityFrameworkCore (1)
Aspire.Pomelo.EntityFrameworkCore.MySql (1)
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore (1)
Microsoft.Extensions.AI (8)
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,
Microsoft.Extensions.DependencyInjection.Abstractions (12)
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)
Aspire.Azure.Data.Tables (1)
Aspire.Azure.Messaging.EventHubs (5)
Aspire.Azure.Messaging.ServiceBus (1)
Aspire.Azure.Messaging.WebPubSub (1)
Aspire.Azure.Npgsql (1)
Aspire.Azure.Npgsql.EntityFrameworkCore.PostgreSQL (5)
Aspire.Azure.Npgsql.EntityFrameworkCore.PostgreSQL.Tests (5)
Aspire.Azure.Search.Documents (1)
Aspire.Azure.Security.KeyVault (1)
Aspire.Azure.Storage.Blobs (1)
Aspire.Azure.Storage.Queues (1)
Aspire.Confluent.Kafka (2)
Aspire.Dashboard (2)
Aspire.Elastic.Clients.Elasticsearch (1)
Aspire.Hosting (10)
Aspire.Hosting.Testing (5)
Aspire.Hosting.Tests (1)
Aspire.Microsoft.Azure.Cosmos (3)
Aspire.Microsoft.Data.SqlClient (1)
Aspire.Microsoft.EntityFrameworkCore.Cosmos (5)
Aspire.Microsoft.EntityFrameworkCore.Cosmos.Tests (1)
Aspire.Microsoft.EntityFrameworkCore.SqlServer (5)
Aspire.Microsoft.EntityFrameworkCore.SqlServer.Tests (5)
Aspire.MongoDB.Driver (1)
Aspire.MySqlConnector (1)
Aspire.NATS.Net (1)
Aspire.Npgsql (1)
Aspire.Npgsql.EntityFrameworkCore.PostgreSQL (5)
Aspire.Npgsql.EntityFrameworkCore.PostgreSQL.Tests (5)
Aspire.OpenAI (1)
Aspire.Oracle.EntityFrameworkCore (5)
Aspire.Oracle.EntityFrameworkCore.Tests (5)
Aspire.Pomelo.EntityFrameworkCore.MySql (5)
Aspire.Pomelo.EntityFrameworkCore.MySql.Tests (5)
Aspire.RabbitMQ.Client (1)
Aspire.StackExchange.Redis (1)
Aspire.StackExchange.Redis.DistributedCaching (1)
Aspire.StackExchange.Redis.OutputCaching (1)
IntegrationTestsWebsite (1)
Microsoft.AspNetCore (7)
Microsoft.AspNetCore.Antiforgery (1)
Microsoft.AspNetCore.AsyncState.Tests (1)
Microsoft.AspNetCore.Authentication (2)
Microsoft.AspNetCore.Authentication.BearerToken (2)
Microsoft.AspNetCore.Authentication.Cookies (1)
Microsoft.AspNetCore.Authentication.JwtBearer (2)
Microsoft.AspNetCore.Authentication.Negotiate (2)
Microsoft.AspNetCore.Authentication.OAuth (1)
Microsoft.AspNetCore.Authentication.OpenIdConnect (2)
Microsoft.AspNetCore.Authentication.Twitter (1)
Microsoft.AspNetCore.Authentication.WsFederation (1)
Microsoft.AspNetCore.Authorization (7)
Microsoft.AspNetCore.Components (6)
Microsoft.AspNetCore.Components.Endpoints (1)
Microsoft.AspNetCore.Components.Endpoints.Tests (4)
Microsoft.AspNetCore.Components.Server (4)
Microsoft.AspNetCore.Components.Web (1)
Microsoft.AspNetCore.Components.WebAssembly.Server (2)
Microsoft.AspNetCore.Cors (2)
Microsoft.AspNetCore.DataProtection (5)
Microsoft.AspNetCore.DataProtection.Tests (4)
Microsoft.AspNetCore.Diagnostics.Middleware (2)
Microsoft.AspNetCore.Grpc.JsonTranscoding (2)
Microsoft.AspNetCore.Grpc.Swagger (2)
Microsoft.AspNetCore.Hosting (5)
Microsoft.AspNetCore.Hosting.Tests (4)
Microsoft.AspNetCore.Http.Connections (1)
Microsoft.AspNetCore.Http.Extensions (2)
Microsoft.AspNetCore.Http.Extensions.Tests (2)
Microsoft.AspNetCore.Http.Tests (1)
Microsoft.AspNetCore.HttpLogging (1)
Microsoft.AspNetCore.Identity (3)
Microsoft.AspNetCore.MiddlewareAnalysis (1)
Microsoft.AspNetCore.Mvc (2)
Microsoft.AspNetCore.Mvc.ApiExplorer (2)
Microsoft.AspNetCore.Mvc.Core (20)
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)
Microsoft.AspNetCore.Mvc.Cors (1)
Microsoft.AspNetCore.Mvc.DataAnnotations (2)
Microsoft.AspNetCore.Mvc.Formatters.Xml (4)
Microsoft.AspNetCore.Mvc.FunctionalTests (2)
Microsoft.AspNetCore.Mvc.Localization (3)
Microsoft.AspNetCore.Mvc.Localization.Test (7)
Microsoft.AspNetCore.Mvc.NewtonsoftJson (5)
Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test (3)
Microsoft.AspNetCore.Mvc.Razor (3)
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation (7)
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation.Test (2)
Microsoft.AspNetCore.Mvc.Razor.Test (8)
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)
Microsoft.AspNetCore.Mvc.ViewFeatures (13)
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (13)
Microsoft.AspNetCore.OpenApi (1)
Microsoft.AspNetCore.Routing (8)
Microsoft.AspNetCore.Routing.Microbenchmarks (1)
Microsoft.AspNetCore.Server.Kestrel (2)
Microsoft.AspNetCore.SignalR (1)
Microsoft.AspNetCore.SignalR.Client.FunctionalTests (1)
Microsoft.AspNetCore.SignalR.Microbenchmarks (1)
Microsoft.AspNetCore.SignalR.Protocols.Json (1)
Microsoft.AspNetCore.SignalR.Protocols.MessagePack (1)
Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson (1)
Microsoft.AspNetCore.SignalR.Tests (2)
Microsoft.AspNetCore.SpaProxy (1)
Microsoft.AspNetCore.Tests (2)
Microsoft.Authentication.WebAssembly.Msal (1)
Microsoft.DotNet.Internal.DependencyInjection.Testing (2)
Microsoft.Extensions.AI.Tests (6)
Microsoft.Extensions.AsyncState.Tests (1)
Microsoft.Extensions.Caching.Memory (2)
Microsoft.Extensions.Caching.SqlServer (1)
Microsoft.Extensions.Caching.SqlServer.Tests (2)
Microsoft.Extensions.Caching.StackExchangeRedis (1)
Microsoft.Extensions.Caching.StackExchangeRedis.Tests (3)
Microsoft.Extensions.Compliance.Redaction (4)
Microsoft.Extensions.DependencyInjection (34)
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];
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.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)
Microsoft.Extensions.Diagnostics.ExceptionSummarization (1)
Microsoft.Extensions.Diagnostics.HealthChecks (1)
Microsoft.Extensions.Diagnostics.ResourceMonitoring (2)
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests (4)
Microsoft.Extensions.Diagnostics.Testing (2)
Microsoft.Extensions.Hosting.Abstractions (2)
Microsoft.Extensions.Http (19)
Microsoft.Extensions.Http.Diagnostics.PerformanceTests (6)
Microsoft.Extensions.Http.Polly (3)
Microsoft.Extensions.Http.Resilience (2)
Microsoft.Extensions.Logging (4)
Microsoft.Extensions.Logging.AzureAppServices (2)
Microsoft.Extensions.Logging.Configuration (2)
Microsoft.Extensions.Logging.Console (6)
Microsoft.Extensions.Logging.Debug (1)
Microsoft.Extensions.Logging.EventLog (2)
Microsoft.Extensions.Logging.EventSource (3)
Microsoft.Extensions.ML (1)
Microsoft.Extensions.Options (6)
Microsoft.Extensions.Options.Contextual (3)
Microsoft.Extensions.ServiceDiscovery (1)
Microsoft.Extensions.Telemetry (3)
Microsoft.Maui (26)
Microsoft.Maui.Controls.Compatibility (1)
Microsoft.ML.AutoML (2)
Mvc.RoutingWebSite (1)