ServiceDescriptor 类

定义

描述一种服务,包括该服务的类型、实现和生存期。Describes a service with its service type, implementation, and lifetime.

public ref class ServiceDescriptor
public class ServiceDescriptor
type ServiceDescriptor = class
Public Class ServiceDescriptor
继承
ServiceDescriptor

构造函数

ServiceDescriptor(Type, Func<IServiceProvider,Object>, ServiceLifetime)

用指定的 ServiceDescriptor 初始化 factory 的新实例。Initializes a new instance of ServiceDescriptor with the specified factory.

ServiceDescriptor(Type, Object)

使用指定的 instance 作为 Singleton 来初始化 ServiceDescriptor 的新实例。Initializes a new instance of ServiceDescriptor with the specified instance as a Singleton.

ServiceDescriptor(Type, Type, ServiceLifetime)

用指定的 ServiceDescriptor 初始化 implementationType 的新实例。Initializes a new instance of ServiceDescriptor with the specified implementationType.

属性

ImplementationFactory
ImplementationInstance
ImplementationType
Lifetime
ServiceType

方法

Describe(Type, Func<IServiceProvider,Object>, ServiceLifetime)

创建具有指定 serviceTypeimplementationFactorylifetimeServiceDescriptor 实例。Creates an instance of ServiceDescriptor with the specified serviceType, implementationFactory, and lifetime.

Describe(Type, Type, ServiceLifetime)

创建具有指定 serviceTypeimplementationTypelifetimeServiceDescriptor 实例。Creates an instance of ServiceDescriptor with the specified serviceType, implementationType, and lifetime.

Equals(Object)

确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
Scoped(Type, Func<IServiceProvider,Object>)

创建具有指定 serviceimplementationFactoryScoped 生存期的 ServiceDescriptor 实例。Creates an instance of ServiceDescriptor with the specified service, implementationFactory, and the Scoped lifetime.

Scoped(Type, Type)

创建具有指定 serviceimplementationTypeScoped 生存期的 ServiceDescriptor 实例。Creates an instance of ServiceDescriptor with the specified service and implementationType and the Scoped lifetime.

Scoped<TService,TImplementation>()

创建具有指定 TServiceTImplementationScoped 生存期的 ServiceDescriptor 实例。Creates an instance of ServiceDescriptor with the specified TService, TImplementation, and the Scoped lifetime.

Scoped<TService,TImplementation>(Func<IServiceProvider,TImplementation>)

创建具有指定 TServiceTImplementationimplementationFactoryScoped 生存期的 ServiceDescriptor 实例。Creates an instance of ServiceDescriptor with the specified TService, TImplementation, implementationFactory, and the Scoped lifetime.

Scoped<TService>(Func<IServiceProvider,TService>)

创建具有指定 TServiceimplementationFactoryScoped 生存期的 ServiceDescriptor 实例。Creates an instance of ServiceDescriptor with the specified TService, implementationFactory, and the Scoped lifetime.

Singleton(Type, Func<IServiceProvider,Object>)

创建具有指定 serviceTypeimplementationFactorySingleton 生存期的 ServiceDescriptor 实例。Creates an instance of ServiceDescriptor with the specified serviceType, implementationFactory, and the Singleton lifetime.

Singleton(Type, Object)

创建具有指定 serviceTypeimplementationInstanceScoped 生存期的 ServiceDescriptor 实例。Creates an instance of ServiceDescriptor with the specified serviceType, implementationInstance, and the Scoped lifetime.

Singleton(Type, Type)

创建具有指定 serviceimplementationTypeSingleton 生存期的 ServiceDescriptor 实例。Creates an instance of ServiceDescriptor with the specified service and implementationType and the Singleton lifetime.

Singleton<TService,TImplementation>()

创建具有指定 TServiceTImplementationSingleton 生存期的 ServiceDescriptor 实例。Creates an instance of ServiceDescriptor with the specified TService, TImplementation, and the Singleton lifetime.

Singleton<TService,TImplementation>(Func<IServiceProvider,TImplementation>)

创建具有指定 TServiceTImplementationimplementationFactorySingleton 生存期的 ServiceDescriptor 实例。Creates an instance of ServiceDescriptor with the specified TService, TImplementation, implementationFactory, and the Singleton lifetime.

Singleton<TService>(Func<IServiceProvider,TService>)

创建具有指定 TServiceimplementationFactorySingleton 生存期的 ServiceDescriptor 实例。Creates an instance of ServiceDescriptor with the specified TService, implementationFactory, and the Singleton lifetime.

Singleton<TService>(TService)

创建具有指定 TServiceimplementationInstanceScoped 生存期的 ServiceDescriptor 实例。Creates an instance of ServiceDescriptor with the specified TService, implementationInstance, and the Scoped lifetime.

ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)
Transient(Type, Func<IServiceProvider,Object>)

创建具有指定 serviceimplementationFactoryTransient 生存期的 ServiceDescriptor 实例。Creates an instance of ServiceDescriptor with the specified service, implementationFactory, and the Transient lifetime.

Transient(Type, Type)

创建具有指定 serviceimplementationTypeTransient 生存期的 ServiceDescriptor 实例。Creates an instance of ServiceDescriptor with the specified service and implementationType and the Transient lifetime.

Transient<TService,TImplementation>()

创建具有指定 TServiceTImplementationTransient 生存期的 ServiceDescriptor 实例。Creates an instance of ServiceDescriptor with the specified TService, TImplementation, and the Transient lifetime.

Transient<TService,TImplementation>(Func<IServiceProvider,TImplementation>)

创建具有指定 TServiceTImplementationimplementationFactoryTransient 生存期的 ServiceDescriptor 实例。Creates an instance of ServiceDescriptor with the specified TService, TImplementation, implementationFactory, and the Transient lifetime.

Transient<TService>(Func<IServiceProvider,TService>)

创建具有指定 TServiceimplementationFactoryTransient 生存期的 ServiceDescriptor 实例。Creates an instance of ServiceDescriptor with the specified TService, implementationFactory, and the Transient lifetime.

适用于