Microsoft.Extensions.DependencyInjection.Abstractions by Microsoft

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

 ServiceDescriptor

public class ServiceDescriptor
Describes a service with its service type, implementation, and lifetime.
public Func<IServiceProvider, object> ImplementationFactory { get; }

Gets the factory used for creating service instances.

public object ImplementationInstance { get; }

Gets the instance that implements the service.

public Type ImplementationType { get; }

Gets the Type that implements the service.

public bool IsKeyedService { get; }

Indicates whether the service is a keyed service.

public Func<IServiceProvider, object, object> KeyedImplementationFactory { get; }

Gets the factory used for creating Keyed service instances.

public object KeyedImplementationInstance { get; }

Gets the instance that implements the service.

public Type KeyedImplementationType { get; }

Gets the Type that implements the service.

public ServiceLifetime Lifetime { get; }

Gets the ServiceLifetime of the service.

public object ServiceKey { get; }

Get the key of the service, if applicable.

public Type ServiceType { get; }

Gets the Type of the service.

public ServiceDescriptor(Type serviceType, Type implementationType, ServiceLifetime lifetime)

Initializes a new instance of ServiceDescriptor with the specified implementationType.

public ServiceDescriptor(Type serviceType, object serviceKey, Type implementationType, ServiceLifetime lifetime)

Initializes a new instance of ServiceDescriptor with the specified implementationType.

public ServiceDescriptor(Type serviceType, object instance)

Initializes a new instance of ServiceDescriptor with the specified instance as a Singleton.

public ServiceDescriptor(Type serviceType, object serviceKey, object instance)

Initializes a new instance of ServiceDescriptor with the specified instance as a Singleton.

public ServiceDescriptor(Type serviceType, Func<IServiceProvider, object> factory, ServiceLifetime lifetime)

Initializes a new instance of ServiceDescriptor with the specified factory.

public ServiceDescriptor(Type serviceType, object serviceKey, Func<IServiceProvider, object, object> factory, ServiceLifetime lifetime)

Initializes a new instance of ServiceDescriptor with the specified factory.

public static ServiceDescriptor Describe(Type serviceType, Type implementationType, ServiceLifetime lifetime)

Creates an instance of ServiceDescriptor with the specified serviceType, implementationType, and lifetime.

public static ServiceDescriptor Describe(Type serviceType, Func<IServiceProvider, object> implementationFactory, ServiceLifetime lifetime)

Creates an instance of ServiceDescriptor with the specified serviceType, implementationFactory, and lifetime.

public static ServiceDescriptor DescribeKeyed(Type serviceType, object serviceKey, Type implementationType, ServiceLifetime lifetime)

Creates an instance of ServiceDescriptor with the specified serviceType, implementationType, and lifetime.

public static ServiceDescriptor DescribeKeyed(Type serviceType, object serviceKey, Func<IServiceProvider, object, object> implementationFactory, ServiceLifetime lifetime)

Creates an instance of ServiceDescriptor with the specified serviceType, implementationFactory, and lifetime.

public static ServiceDescriptor KeyedScoped<TService, TImplementation>(object serviceKey) where TImplementation : TService

Creates an instance of ServiceDescriptor with the specified TService, TImplementation, and the Scoped lifetime.

public static ServiceDescriptor KeyedScoped(Type service, object serviceKey, Type implementationType)

Creates an instance of ServiceDescriptor with the specified service and implementationType and the Scoped lifetime.

public static ServiceDescriptor KeyedScoped<TService, TImplementation>(object serviceKey, Func<IServiceProvider, object, TImplementation> implementationFactory) where TImplementation : TService

Creates an instance of ServiceDescriptor with the specified TService, TImplementation, implementationFactory, and the Scoped lifetime.

public static ServiceDescriptor KeyedScoped<TService>(object serviceKey, Func<IServiceProvider, object, TService> implementationFactory)

Creates an instance of ServiceDescriptor with the specified TService, implementationFactory, and the Scoped lifetime.

public static ServiceDescriptor KeyedScoped(Type service, object serviceKey, Func<IServiceProvider, object, object> implementationFactory)

Creates an instance of ServiceDescriptor with the specified service, implementationFactory, and the Scoped lifetime.

public static ServiceDescriptor KeyedSingleton<TService, TImplementation>(object serviceKey) where TImplementation : TService

Creates an instance of ServiceDescriptor with the specified TService, TImplementation, and the Singleton lifetime.

public static ServiceDescriptor KeyedSingleton(Type service, object serviceKey, Type implementationType)

Creates an instance of ServiceDescriptor with the specified service and implementationType and the Singleton lifetime.

public static ServiceDescriptor KeyedSingleton<TService, TImplementation>(object serviceKey, Func<IServiceProvider, object, TImplementation> implementationFactory) where TImplementation : TService

Creates an instance of ServiceDescriptor with the specified TService, TImplementation, implementationFactory, and the Singleton lifetime.

public static ServiceDescriptor KeyedSingleton<TService>(object serviceKey, Func<IServiceProvider, object, TService> implementationFactory)

Creates an instance of ServiceDescriptor with the specified TService, implementationFactory, and the Singleton lifetime.

public static ServiceDescriptor KeyedSingleton(Type serviceType, object serviceKey, Func<IServiceProvider, object, object> implementationFactory)

Creates an instance of ServiceDescriptor with the specified serviceType, implementationFactory, and the Singleton lifetime.

public static ServiceDescriptor KeyedSingleton<TService>(object serviceKey, TService implementationInstance)

Creates an instance of ServiceDescriptor with the specified TService, implementationInstance, and the Singleton lifetime.

public static ServiceDescriptor KeyedSingleton(Type serviceType, object serviceKey, object implementationInstance)

Creates an instance of ServiceDescriptor with the specified serviceType, implementationInstance, and the Singleton lifetime.

public static ServiceDescriptor KeyedTransient<TService, TImplementation>(object serviceKey) where TImplementation : TService

Creates an instance of ServiceDescriptor with the specified TService, TImplementation, and the Transient lifetime.

public static ServiceDescriptor KeyedTransient(Type service, object serviceKey, Type implementationType)

Creates an instance of ServiceDescriptor with the specified service and implementationType and the Transient lifetime.

public static ServiceDescriptor KeyedTransient<TService, TImplementation>(object serviceKey, Func<IServiceProvider, object, TImplementation> implementationFactory) where TImplementation : TService

Creates an instance of ServiceDescriptor with the specified TService, TImplementation, implementationFactory, and the Transient lifetime.

public static ServiceDescriptor KeyedTransient<TService>(object serviceKey, Func<IServiceProvider, object, TService> implementationFactory)

Creates an instance of ServiceDescriptor with the specified TService, implementationFactory, and the Transient lifetime.

public static ServiceDescriptor KeyedTransient(Type service, object serviceKey, Func<IServiceProvider, object, object> implementationFactory)

Creates an instance of ServiceDescriptor with the specified service, implementationFactory, and the Transient lifetime.

public static ServiceDescriptor Scoped<TService, TImplementation>() where TImplementation : TService

Creates an instance of ServiceDescriptor with the specified TService, TImplementation, and the Scoped lifetime.

public static ServiceDescriptor Scoped(Type service, Type implementationType)

Creates an instance of ServiceDescriptor with the specified service and implementationType and the Scoped lifetime.

public static ServiceDescriptor Scoped<TService, TImplementation>(Func<IServiceProvider, TImplementation> implementationFactory) where TImplementation : TService

Creates an instance of ServiceDescriptor with the specified TService, TImplementation, implementationFactory, and the Scoped lifetime.

public static ServiceDescriptor Scoped<TService>(Func<IServiceProvider, TService> implementationFactory)

Creates an instance of ServiceDescriptor with the specified TService, implementationFactory, and the Scoped lifetime.

public static ServiceDescriptor Scoped(Type service, Func<IServiceProvider, object> implementationFactory)

Creates an instance of ServiceDescriptor with the specified service, implementationFactory, and the Scoped lifetime.

public static ServiceDescriptor Singleton<TService, TImplementation>() where TImplementation : TService

Creates an instance of ServiceDescriptor with the specified TService, TImplementation, and the Singleton lifetime.

public static ServiceDescriptor Singleton(Type service, Type implementationType)

Creates an instance of ServiceDescriptor with the specified service and implementationType and the Singleton lifetime.

public static ServiceDescriptor Singleton<TService, TImplementation>(Func<IServiceProvider, TImplementation> implementationFactory) where TImplementation : TService

Creates an instance of ServiceDescriptor with the specified TService, TImplementation, implementationFactory, and the Singleton lifetime.

public static ServiceDescriptor Singleton<TService>(Func<IServiceProvider, TService> implementationFactory)

Creates an instance of ServiceDescriptor with the specified TService, implementationFactory, and the Singleton lifetime.

public static ServiceDescriptor Singleton(Type serviceType, Func<IServiceProvider, object> implementationFactory)

Creates an instance of ServiceDescriptor with the specified serviceType, implementationFactory, and the Singleton lifetime.

public static ServiceDescriptor Singleton<TService>(TService implementationInstance)

Creates an instance of ServiceDescriptor with the specified TService, implementationInstance, and the Singleton lifetime.

public static ServiceDescriptor Singleton(Type serviceType, object implementationInstance)

Creates an instance of ServiceDescriptor with the specified serviceType, implementationInstance, and the Singleton lifetime.

public static ServiceDescriptor Transient<TService, TImplementation>() where TImplementation : TService

Creates an instance of ServiceDescriptor with the specified TService, TImplementation, and the Transient lifetime.

public static ServiceDescriptor Transient(Type service, Type implementationType)

Creates an instance of ServiceDescriptor with the specified service and implementationType and the Transient lifetime.

public static ServiceDescriptor Transient<TService, TImplementation>(Func<IServiceProvider, TImplementation> implementationFactory) where TImplementation : TService

Creates an instance of ServiceDescriptor with the specified TService, TImplementation, implementationFactory, and the Transient lifetime.

public static ServiceDescriptor Transient<TService>(Func<IServiceProvider, TService> implementationFactory)

Creates an instance of ServiceDescriptor with the specified TService, implementationFactory, and the Transient lifetime.

public static ServiceDescriptor Transient(Type service, Func<IServiceProvider, object> implementationFactory)

Creates an instance of ServiceDescriptor with the specified service, implementationFactory, and the Transient lifetime.