ServiceDescriptor Class

Namespace
Microsoft.Extensions.DependencyInjection
Assemblies
  • Microsoft.Extensions.DependencyInjection.Abstractions

Syntax

[DebuggerDisplay("Lifetime = {Lifetime}, ServiceType = {ServiceType}, ImplementationType = {ImplementationType}")]
public class ServiceDescriptor
class Microsoft.Extensions.DependencyInjection.ServiceDescriptor

Constructors

ServiceDescriptor(System.Type, System.Func<System.IServiceProvider, System.Object>, Microsoft.Extensions.DependencyInjection.ServiceLifetime)

Initializes a new instance of Microsoft.Extensions.DependencyInjection.ServiceDescriptor with the specified <em>factory</em>.

Arguments:
public ServiceDescriptor(Type serviceType, Func<IServiceProvider, object> factory, ServiceLifetime lifetime)
ServiceDescriptor(System.Type, System.Object)

Initializes a new instance of Microsoft.Extensions.DependencyInjection.ServiceDescriptor with the specified <em>instance</em> as a Microsoft.Extensions.DependencyInjection.ServiceLifetime.Singleton.

Arguments:
  • serviceType (System.Type) – The System.Type of the service.
  • instance (System.Object) – The instance implementing the service.
public ServiceDescriptor(Type serviceType, object instance)
ServiceDescriptor(System.Type, System.Type, Microsoft.Extensions.DependencyInjection.ServiceLifetime)

Initializes a new instance of Microsoft.Extensions.DependencyInjection.ServiceDescriptor with the specified <em>implementationType</em>.

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

Methods

Describe(System.Type, System.Func<System.IServiceProvider, System.Object>, Microsoft.Extensions.DependencyInjection.ServiceLifetime)
Return type:Microsoft.Extensions.DependencyInjection.ServiceDescriptor
public static ServiceDescriptor Describe(Type serviceType, Func<IServiceProvider, object> implementationFactory, ServiceLifetime lifetime)
Describe(System.Type, System.Type, Microsoft.Extensions.DependencyInjection.ServiceLifetime)
Return type:Microsoft.Extensions.DependencyInjection.ServiceDescriptor
public static ServiceDescriptor Describe(Type serviceType, Type implementationType, ServiceLifetime lifetime)
Scoped(System.Type, System.Func<System.IServiceProvider, System.Object>)
Return type:Microsoft.Extensions.DependencyInjection.ServiceDescriptor
public static ServiceDescriptor Scoped(Type service, Func<IServiceProvider, object> implementationFactory)
Scoped(System.Type, System.Type)
Return type:Microsoft.Extensions.DependencyInjection.ServiceDescriptor
public static ServiceDescriptor Scoped(Type service, Type implementationType)
Scoped<TService>(System.Func<System.IServiceProvider, TService>)
Return type:Microsoft.Extensions.DependencyInjection.ServiceDescriptor
public static ServiceDescriptor Scoped<TService>(Func<IServiceProvider, TService> implementationFactory)where TService : class
Scoped<TService, TImplementation>()
Return type:Microsoft.Extensions.DependencyInjection.ServiceDescriptor
public static ServiceDescriptor Scoped<TService, TImplementation>()where TService : class where TImplementation : class, TService
Scoped<TService, TImplementation>(System.Func<System.IServiceProvider, TImplementation>)
Return type:Microsoft.Extensions.DependencyInjection.ServiceDescriptor
public static ServiceDescriptor Scoped<TService, TImplementation>(Func<IServiceProvider, TImplementation> implementationFactory)where TService : class where TImplementation : class, TService
Singleton(System.Type, System.Func<System.IServiceProvider, System.Object>)
Return type:Microsoft.Extensions.DependencyInjection.ServiceDescriptor
public static ServiceDescriptor Singleton(Type serviceType, Func<IServiceProvider, object> implementationFactory)
Singleton(System.Type, System.Object)
Return type:Microsoft.Extensions.DependencyInjection.ServiceDescriptor
public static ServiceDescriptor Singleton(Type serviceType, object implementationInstance)
Singleton(System.Type, System.Type)
Return type:Microsoft.Extensions.DependencyInjection.ServiceDescriptor
public static ServiceDescriptor Singleton(Type service, Type implementationType)
Singleton<TService>(System.Func<System.IServiceProvider, TService>)
Return type:Microsoft.Extensions.DependencyInjection.ServiceDescriptor
public static ServiceDescriptor Singleton<TService>(Func<IServiceProvider, TService> implementationFactory)where TService : class
Singleton<TService>(TService)
Return type:Microsoft.Extensions.DependencyInjection.ServiceDescriptor
public static ServiceDescriptor Singleton<TService>(TService implementationInstance)where TService : class
Singleton<TService, TImplementation>()
Return type:Microsoft.Extensions.DependencyInjection.ServiceDescriptor
public static ServiceDescriptor Singleton<TService, TImplementation>()where TService : class where TImplementation : class, TService
Singleton<TService, TImplementation>(System.Func<System.IServiceProvider, TImplementation>)
Return type:Microsoft.Extensions.DependencyInjection.ServiceDescriptor
public static ServiceDescriptor Singleton<TService, TImplementation>(Func<IServiceProvider, TImplementation> implementationFactory)where TService : class where TImplementation : class, TService
Transient(System.Type, System.Func<System.IServiceProvider, System.Object>)
Return type:Microsoft.Extensions.DependencyInjection.ServiceDescriptor
public static ServiceDescriptor Transient(Type service, Func<IServiceProvider, object> implementationFactory)
Transient(System.Type, System.Type)
Return type:Microsoft.Extensions.DependencyInjection.ServiceDescriptor
public static ServiceDescriptor Transient(Type service, Type implementationType)
Transient<TService>(System.Func<System.IServiceProvider, TService>)
Return type:Microsoft.Extensions.DependencyInjection.ServiceDescriptor
public static ServiceDescriptor Transient<TService>(Func<IServiceProvider, TService> implementationFactory)where TService : class
Transient<TService, TImplementation>()
Return type:Microsoft.Extensions.DependencyInjection.ServiceDescriptor
public static ServiceDescriptor Transient<TService, TImplementation>()where TService : class where TImplementation : class, TService
Transient<TService, TImplementation>(System.Func<System.IServiceProvider, TImplementation>)
Return type:Microsoft.Extensions.DependencyInjection.ServiceDescriptor
public static ServiceDescriptor Transient<TService, TImplementation>(Func<IServiceProvider, TImplementation> implementationFactory)where TService : class where TImplementation : class, TService

Properties

Microsoft.Extensions.DependencyInjection.ServiceDescriptor.ImplementationFactory
Return type:System.Func<System.IServiceProvider>
public Func<IServiceProvider, object> ImplementationFactory { get; }
Microsoft.Extensions.DependencyInjection.ServiceDescriptor.ImplementationInstance
Return type:System.Object
public object ImplementationInstance { get; }
Microsoft.Extensions.DependencyInjection.ServiceDescriptor.ImplementationType
Return type:System.Type
public Type ImplementationType { get; }
Microsoft.Extensions.DependencyInjection.ServiceDescriptor.Lifetime
Return type:Microsoft.Extensions.DependencyInjection.ServiceLifetime
public ServiceLifetime Lifetime { get; }
Microsoft.Extensions.DependencyInjection.ServiceDescriptor.ServiceType
Return type:System.Type
public Type ServiceType { get; }