Class ServiceDescriptor
Inheritance
ServiceDescriptor
Assembly: Microsoft.Extensions.DependencyInjection.Abstractions.dll
Syntax
public class ServiceDescriptor
Constructors
ServiceDescriptor(Type, Func<IServiceProvider, object>, ServiceLifetime)
Declaration
public ServiceDescriptor(Type serviceType, Func<IServiceProvider, object> factory, ServiceLifetime lifetime)
Parameters
ServiceDescriptor(Type, object)
Declaration
public ServiceDescriptor(Type serviceType, object instance)
Parameters
Type |
Name |
Description |
Type |
serviceType |
|
object |
instance |
|
ServiceDescriptor(Type, object?, Func<IServiceProvider, object?, object>, ServiceLifetime)
Declaration
public ServiceDescriptor(Type serviceType, object? serviceKey, Func<IServiceProvider, object?, object> factory, ServiceLifetime lifetime)
Parameters
ServiceDescriptor(Type, object?, object)
Declaration
public ServiceDescriptor(Type serviceType, object? serviceKey, object instance)
Parameters
ServiceDescriptor(Type, object?, Type, ServiceLifetime)
Declaration
public ServiceDescriptor(Type serviceType, object? serviceKey, Type implementationType, ServiceLifetime lifetime)
Parameters
ServiceDescriptor(Type, Type, ServiceLifetime)
Declaration
public ServiceDescriptor(Type serviceType, Type implementationType, ServiceLifetime lifetime)
Parameters
Properties
ImplementationFactory
Declaration
public Func<IServiceProvider, object>? ImplementationFactory { get; }
Property Value
ImplementationInstance
Declaration
public object? ImplementationInstance { get; }
Property Value
ImplementationType
Declaration
public Type? ImplementationType { get; }
Property Value
IsKeyedService
Declaration
public bool IsKeyedService { get; }
Property Value
KeyedImplementationFactory
Declaration
public Func<IServiceProvider, object?, object>? KeyedImplementationFactory { get; }
Property Value
KeyedImplementationInstance
Declaration
public object? KeyedImplementationInstance { get; }
Property Value
KeyedImplementationType
Declaration
public Type? KeyedImplementationType { get; }
Property Value
Lifetime
Declaration
public ServiceLifetime Lifetime { get; }
Property Value
ServiceKey
Declaration
public object? ServiceKey { get; }
Property Value
ServiceType
Declaration
public Type ServiceType { get; }
Property Value
Methods
Describe(Type, Func<IServiceProvider, object>, ServiceLifetime)
Declaration
public static ServiceDescriptor Describe(Type serviceType, Func<IServiceProvider, object> implementationFactory, ServiceLifetime lifetime)
Parameters
Returns
Describe(Type, Type, ServiceLifetime)
Declaration
public static ServiceDescriptor Describe(Type serviceType, Type implementationType, ServiceLifetime lifetime)
Parameters
Returns
DescribeKeyed(Type, object?, Func<IServiceProvider, object?, object>, ServiceLifetime)
Declaration
public static ServiceDescriptor DescribeKeyed(Type serviceType, object? serviceKey, Func<IServiceProvider, object?, object> implementationFactory, ServiceLifetime lifetime)
Parameters
Returns
DescribeKeyed(Type, object?, Type, ServiceLifetime)
Declaration
public static ServiceDescriptor DescribeKeyed(Type serviceType, object? serviceKey, Type implementationType, ServiceLifetime lifetime)
Parameters
Returns
KeyedScoped(Type, object?, Func<IServiceProvider, object?, object>)
Declaration
public static ServiceDescriptor KeyedScoped(Type service, object? serviceKey, Func<IServiceProvider, object?, object> implementationFactory)
Parameters
Returns
KeyedScoped(Type, object?, Type)
Declaration
public static ServiceDescriptor KeyedScoped(Type service, object? serviceKey, Type implementationType)
Parameters
Type |
Name |
Description |
Type |
service |
|
object |
serviceKey |
|
Type |
implementationType |
|
Returns
KeyedScoped<TService>(object?, Func<IServiceProvider, object?, TService>)
Declaration
public static ServiceDescriptor KeyedScoped<TService>(object? serviceKey, Func<IServiceProvider, object?, TService> implementationFactory) where TService : class
Parameters
Returns
Type Parameters
Name |
Description |
TService |
|
KeyedScoped<TService, TImplementation>(object?)
Declaration
public static ServiceDescriptor KeyedScoped<TService, TImplementation>(object? serviceKey) where TService : class where TImplementation : class, TService
Parameters
Type |
Name |
Description |
object |
serviceKey |
|
Returns
Type Parameters
Name |
Description |
TService |
|
TImplementation |
|
KeyedScoped<TService, TImplementation>(object?, Func<IServiceProvider, object?, TImplementation>)
Declaration
public static ServiceDescriptor KeyedScoped<TService, TImplementation>(object? serviceKey, Func<IServiceProvider, object?, TImplementation> implementationFactory) where TService : class where TImplementation : class, TService
Parameters
Returns
Type Parameters
Name |
Description |
TService |
|
TImplementation |
|
KeyedSingleton(Type, object?, Func<IServiceProvider, object?, object>)
Declaration
public static ServiceDescriptor KeyedSingleton(Type serviceType, object? serviceKey, Func<IServiceProvider, object?, object> implementationFactory)
Parameters
Returns
KeyedSingleton(Type, object?, object)
Declaration
public static ServiceDescriptor KeyedSingleton(Type serviceType, object? serviceKey, object implementationInstance)
Parameters
Type |
Name |
Description |
Type |
serviceType |
|
object |
serviceKey |
|
object |
implementationInstance |
|
Returns
KeyedSingleton(Type, object?, Type)
Declaration
public static ServiceDescriptor KeyedSingleton(Type service, object? serviceKey, Type implementationType)
Parameters
Type |
Name |
Description |
Type |
service |
|
object |
serviceKey |
|
Type |
implementationType |
|
Returns
KeyedSingleton<TService>(object?, Func<IServiceProvider, object?, TService>)
Declaration
public static ServiceDescriptor KeyedSingleton<TService>(object? serviceKey, Func<IServiceProvider, object?, TService> implementationFactory) where TService : class
Parameters
Returns
Type Parameters
Name |
Description |
TService |
|
KeyedSingleton<TService>(object?, TService)
Declaration
public static ServiceDescriptor KeyedSingleton<TService>(object? serviceKey, TService implementationInstance) where TService : class
Parameters
Type |
Name |
Description |
object |
serviceKey |
|
TService |
implementationInstance |
|
Returns
Type Parameters
Name |
Description |
TService |
|
KeyedSingleton<TService, TImplementation>(object?)
Declaration
public static ServiceDescriptor KeyedSingleton<TService, TImplementation>(object? serviceKey) where TService : class where TImplementation : class, TService
Parameters
Type |
Name |
Description |
object |
serviceKey |
|
Returns
Type Parameters
Name |
Description |
TService |
|
TImplementation |
|
KeyedSingleton<TService, TImplementation>(object?, Func<IServiceProvider, object?, TImplementation>)
Declaration
public static ServiceDescriptor KeyedSingleton<TService, TImplementation>(object? serviceKey, Func<IServiceProvider, object?, TImplementation> implementationFactory) where TService : class where TImplementation : class, TService
Parameters
Returns
Type Parameters
Name |
Description |
TService |
|
TImplementation |
|
KeyedTransient(Type, object?, Func<IServiceProvider, object?, object>)
Declaration
public static ServiceDescriptor KeyedTransient(Type service, object? serviceKey, Func<IServiceProvider, object?, object> implementationFactory)
Parameters
Returns
KeyedTransient(Type, object?, Type)
Declaration
public static ServiceDescriptor KeyedTransient(Type service, object? serviceKey, Type implementationType)
Parameters
Type |
Name |
Description |
Type |
service |
|
object |
serviceKey |
|
Type |
implementationType |
|
Returns
KeyedTransient<TService>(object?, Func<IServiceProvider, object?, TService>)
Declaration
public static ServiceDescriptor KeyedTransient<TService>(object? serviceKey, Func<IServiceProvider, object?, TService> implementationFactory) where TService : class
Parameters
Returns
Type Parameters
Name |
Description |
TService |
|
KeyedTransient<TService, TImplementation>(object?)
Declaration
public static ServiceDescriptor KeyedTransient<TService, TImplementation>(object? serviceKey) where TService : class where TImplementation : class, TService
Parameters
Type |
Name |
Description |
object |
serviceKey |
|
Returns
Type Parameters
Name |
Description |
TService |
|
TImplementation |
|
KeyedTransient<TService, TImplementation>(object?, Func<IServiceProvider, object?, TImplementation>)
Declaration
public static ServiceDescriptor KeyedTransient<TService, TImplementation>(object? serviceKey, Func<IServiceProvider, object?, TImplementation> implementationFactory) where TService : class where TImplementation : class, TService
Parameters
Returns
Type Parameters
Name |
Description |
TService |
|
TImplementation |
|
Scoped(Type, Func<IServiceProvider, object>)
Declaration
public static ServiceDescriptor Scoped(Type service, Func<IServiceProvider, object> implementationFactory)
Parameters
Returns
Scoped(Type, Type)
Declaration
public static ServiceDescriptor Scoped(Type service, Type implementationType)
Parameters
Type |
Name |
Description |
Type |
service |
|
Type |
implementationType |
|
Returns
Scoped<TService>(Func<IServiceProvider, TService>)
Declaration
public static ServiceDescriptor Scoped<TService>(Func<IServiceProvider, TService> implementationFactory) where TService : class
Parameters
Returns
Type Parameters
Name |
Description |
TService |
|
Scoped<TService, TImplementation>()
Declaration
public static ServiceDescriptor Scoped<TService, TImplementation>() where TService : class where TImplementation : class, TService
Returns
Type Parameters
Name |
Description |
TService |
|
TImplementation |
|
Scoped<TService, TImplementation>(Func<IServiceProvider, TImplementation>)
Declaration
public static ServiceDescriptor Scoped<TService, TImplementation>(Func<IServiceProvider, TImplementation> implementationFactory) where TService : class where TImplementation : class, TService
Parameters
Returns
Type Parameters
Name |
Description |
TService |
|
TImplementation |
|
Singleton(Type, Func<IServiceProvider, object>)
Declaration
public static ServiceDescriptor Singleton(Type serviceType, Func<IServiceProvider, object> implementationFactory)
Parameters
Returns
Singleton(Type, object)
Declaration
public static ServiceDescriptor Singleton(Type serviceType, object implementationInstance)
Parameters
Type |
Name |
Description |
Type |
serviceType |
|
object |
implementationInstance |
|
Returns
Singleton(Type, Type)
Declaration
public static ServiceDescriptor Singleton(Type service, Type implementationType)
Parameters
Type |
Name |
Description |
Type |
service |
|
Type |
implementationType |
|
Returns
Singleton<TService>(Func<IServiceProvider, TService>)
Declaration
public static ServiceDescriptor Singleton<TService>(Func<IServiceProvider, TService> implementationFactory) where TService : class
Parameters
Returns
Type Parameters
Name |
Description |
TService |
|
Singleton<TService>(TService)
Declaration
public static ServiceDescriptor Singleton<TService>(TService implementationInstance) where TService : class
Parameters
Type |
Name |
Description |
TService |
implementationInstance |
|
Returns
Type Parameters
Name |
Description |
TService |
|
Singleton<TService, TImplementation>()
Declaration
public static ServiceDescriptor Singleton<TService, TImplementation>() where TService : class where TImplementation : class, TService
Returns
Type Parameters
Name |
Description |
TService |
|
TImplementation |
|
Singleton<TService, TImplementation>(Func<IServiceProvider, TImplementation>)
Declaration
public static ServiceDescriptor Singleton<TService, TImplementation>(Func<IServiceProvider, TImplementation> implementationFactory) where TService : class where TImplementation : class, TService
Parameters
Returns
Type Parameters
Name |
Description |
TService |
|
TImplementation |
|
ToString()
Declaration
public override string ToString()
Returns
Overrides
Transient(Type, Func<IServiceProvider, object>)
Declaration
public static ServiceDescriptor Transient(Type service, Func<IServiceProvider, object> implementationFactory)
Parameters
Returns
Transient(Type, Type)
Declaration
public static ServiceDescriptor Transient(Type service, Type implementationType)
Parameters
Type |
Name |
Description |
Type |
service |
|
Type |
implementationType |
|
Returns
Transient<TService>(Func<IServiceProvider, TService>)
Declaration
public static ServiceDescriptor Transient<TService>(Func<IServiceProvider, TService> implementationFactory) where TService : class
Parameters
Returns
Type Parameters
Name |
Description |
TService |
|
Transient<TService, TImplementation>()
Declaration
public static ServiceDescriptor Transient<TService, TImplementation>() where TService : class where TImplementation : class, TService
Returns
Type Parameters
Name |
Description |
TService |
|
TImplementation |
|
Transient<TService, TImplementation>(Func<IServiceProvider, TImplementation>)
Declaration
public static ServiceDescriptor Transient<TService, TImplementation>(Func<IServiceProvider, TImplementation> implementationFactory) where TService : class where TImplementation : class, TService
Parameters
Returns
Type Parameters
Name |
Description |
TService |
|
TImplementation |
|