<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.4" />

Microsoft.Extensions.DependencyInjection.ServiceDescriptor

public class ServiceDescriptor
Describes a service with its service type, implementation, and lifetime.
namespace Microsoft.Extensions.DependencyInjection { public class ServiceDescriptor { public ServiceLifetime Lifetime { get; } public object ServiceKey { get; } public Type ServiceType { get; } public Type ImplementationType { get; } public Type KeyedImplementationType { get; } public object ImplementationInstance { get; } public object KeyedImplementationInstance { get; } public Func<IServiceProvider, object> ImplementationFactory { get; } public Func<IServiceProvider, object, object> KeyedImplementationFactory { get; } public bool IsKeyedService { get; } public ServiceDescriptor(Type serviceType, Type implementationType, ServiceLifetime lifetime); public ServiceDescriptor(Type serviceType, object serviceKey, Type implementationType, ServiceLifetime lifetime); public ServiceDescriptor(Type serviceType, object instance); public ServiceDescriptor(Type serviceType, object serviceKey, object instance); public ServiceDescriptor(Type serviceType, Func<IServiceProvider, object> factory, ServiceLifetime lifetime); public ServiceDescriptor(Type serviceType, object serviceKey, Func<IServiceProvider, object, object> factory, ServiceLifetime lifetime); public static ServiceDescriptor Transient<TService, [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] TImplementation>() where TService : class where TImplementation : class, TService; public static ServiceDescriptor KeyedTransient<TService, [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] TImplementation>(object serviceKey) where TService : class where TImplementation : class, TService; public static ServiceDescriptor Transient(Type service, Type implementationType); public static ServiceDescriptor KeyedTransient(Type service, object serviceKey, Type implementationType); public static ServiceDescriptor Transient<TService, TImplementation>(Func<IServiceProvider, TImplementation> implementationFactory) where TService : class where TImplementation : class, TService; public static ServiceDescriptor KeyedTransient<TService, TImplementation>(object serviceKey, Func<IServiceProvider, object, TImplementation> implementationFactory) where TService : class where TImplementation : class, TService; public static ServiceDescriptor Transient<TService>(Func<IServiceProvider, TService> implementationFactory) where TService : class; public static ServiceDescriptor KeyedTransient<TService>(object serviceKey, Func<IServiceProvider, object, TService> implementationFactory) where TService : class; public static ServiceDescriptor Transient(Type service, Func<IServiceProvider, object> implementationFactory); public static ServiceDescriptor KeyedTransient(Type service, object serviceKey, Func<IServiceProvider, object, object> implementationFactory); public static ServiceDescriptor Scoped<TService, [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] TImplementation>() where TService : class where TImplementation : class, TService; public static ServiceDescriptor KeyedScoped<TService, [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] TImplementation>(object serviceKey) where TService : class where TImplementation : class, TService; public static ServiceDescriptor Scoped(Type service, Type implementationType); public static ServiceDescriptor KeyedScoped(Type service, object serviceKey, Type implementationType); public static ServiceDescriptor Scoped<TService, TImplementation>(Func<IServiceProvider, TImplementation> implementationFactory) where TService : class where TImplementation : class, TService; public static ServiceDescriptor KeyedScoped<TService, TImplementation>(object serviceKey, Func<IServiceProvider, object, TImplementation> implementationFactory) where TService : class where TImplementation : class, TService; public static ServiceDescriptor Scoped<TService>(Func<IServiceProvider, TService> implementationFactory) where TService : class; public static ServiceDescriptor KeyedScoped<TService>(object serviceKey, Func<IServiceProvider, object, TService> implementationFactory) where TService : class; public static ServiceDescriptor Scoped(Type service, Func<IServiceProvider, object> implementationFactory); public static ServiceDescriptor KeyedScoped(Type service, object serviceKey, Func<IServiceProvider, object, object> implementationFactory); public static ServiceDescriptor Singleton<TService, [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] TImplementation>() where TService : class where TImplementation : class, TService; public static ServiceDescriptor KeyedSingleton<TService, [System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicConstructors)] TImplementation>(object serviceKey) where TService : class where TImplementation : class, TService; public static ServiceDescriptor Singleton(Type service, Type implementationType); public static ServiceDescriptor KeyedSingleton(Type service, object serviceKey, Type implementationType); public static ServiceDescriptor Singleton<TService, TImplementation>(Func<IServiceProvider, TImplementation> implementationFactory) where TService : class where TImplementation : class, TService; public static ServiceDescriptor KeyedSingleton<TService, TImplementation>(object serviceKey, Func<IServiceProvider, object, TImplementation> implementationFactory) where TService : class where TImplementation : class, TService; public static ServiceDescriptor Singleton<TService>(Func<IServiceProvider, TService> implementationFactory) where TService : class; public static ServiceDescriptor KeyedSingleton<TService>(object serviceKey, Func<IServiceProvider, object, TService> implementationFactory) where TService : class; public static ServiceDescriptor Singleton(Type serviceType, Func<IServiceProvider, object> implementationFactory); public static ServiceDescriptor KeyedSingleton(Type serviceType, object serviceKey, Func<IServiceProvider, object, object> implementationFactory); public static ServiceDescriptor Singleton<TService>(TService implementationInstance) where TService : class; public static ServiceDescriptor KeyedSingleton<TService>(object serviceKey, TService implementationInstance) where TService : class; public static ServiceDescriptor Singleton(Type serviceType, object implementationInstance); public static ServiceDescriptor KeyedSingleton(Type serviceType, object serviceKey, object implementationInstance); public static ServiceDescriptor Describe(Type serviceType, Type implementationType, ServiceLifetime lifetime); public static ServiceDescriptor DescribeKeyed(Type serviceType, object serviceKey, Type implementationType, ServiceLifetime lifetime); public static ServiceDescriptor Describe(Type serviceType, Func<IServiceProvider, object> implementationFactory, ServiceLifetime lifetime); public static ServiceDescriptor DescribeKeyed(Type serviceType, object serviceKey, Func<IServiceProvider, object, object> implementationFactory, ServiceLifetime lifetime); } }