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)

使用指定的 ServiceDescriptor,將 instance 的新執行個體初始化為 SingletonInitializes 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)

使用指定的 ServiceDescriptorserviceTypeimplementationFactory 來建立 lifetime 的執行個體。Creates an instance of ServiceDescriptor with the specified serviceType, implementationFactory, and lifetime.

Describe(Type, Type, ServiceLifetime)

使用指定的 ServiceDescriptorserviceTypeimplementationType 來建立 lifetime 的執行個體。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>)

使用指定的 ServiceDescriptorserviceimplementationFactory 存留期來建立 Scoped 的執行個體。Creates an instance of ServiceDescriptor with the specified service, implementationFactory, and the Scoped lifetime.

Scoped(Type, Type)

使用指定的 ServiceDescriptorserviceimplementationType 存留期來建立 Scoped 的執行個體。Creates an instance of ServiceDescriptor with the specified service and implementationType and the Scoped lifetime.

Scoped<TService,TImplementation>()

使用指定的 ServiceDescriptorTServiceTImplementation 存留期來建立 Scoped 的執行個體。Creates an instance of ServiceDescriptor with the specified TService, TImplementation, and the Scoped lifetime.

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

使用指定的 ServiceDescriptorTServiceTImplementationimplementationFactory 存留期來建立 Scoped 的執行個體。Creates an instance of ServiceDescriptor with the specified TService, TImplementation, implementationFactory, and the Scoped lifetime.

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

使用指定的 ServiceDescriptorTServiceimplementationFactory 存留期來建立 Scoped 的執行個體。Creates an instance of ServiceDescriptor with the specified TService, implementationFactory, and the Scoped lifetime.

Singleton(Type, Func<IServiceProvider,Object>)

使用指定的 ServiceDescriptorserviceTypeimplementationFactory 存留期來建立 Singleton 的執行個體。Creates an instance of ServiceDescriptor with the specified serviceType, implementationFactory, and the Singleton lifetime.

Singleton(Type, Object)

使用指定的 ServiceDescriptorserviceTypeimplementationInstance 存留期來建立 Scoped 的執行個體。Creates an instance of ServiceDescriptor with the specified serviceType, implementationInstance, and the Scoped lifetime.

Singleton(Type, Type)

使用指定的 ServiceDescriptorserviceimplementationType 存留期來建立 Singleton 的執行個體。Creates an instance of ServiceDescriptor with the specified service and implementationType and the Singleton lifetime.

Singleton<TService,TImplementation>()

使用指定的 ServiceDescriptorTServiceTImplementation 存留期來建立 Singleton 的執行個體。Creates an instance of ServiceDescriptor with the specified TService, TImplementation, and the Singleton lifetime.

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

使用指定的 ServiceDescriptorTServiceTImplementationimplementationFactory 存留期來建立 Singleton 的執行個體。Creates an instance of ServiceDescriptor with the specified TService, TImplementation, implementationFactory, and the Singleton lifetime.

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

使用指定的 ServiceDescriptorTServiceimplementationFactory 存留期來建立 Singleton 的執行個體。Creates an instance of ServiceDescriptor with the specified TService, implementationFactory, and the Singleton lifetime.

Singleton<TService>(TService)

使用指定的 ServiceDescriptorTServiceimplementationInstance 存留期來建立 Scoped 的執行個體。Creates an instance of ServiceDescriptor with the specified TService, implementationInstance, and the Scoped lifetime.

ToString()
Transient(Type, Func<IServiceProvider,Object>)

使用指定的 ServiceDescriptorserviceimplementationFactory 存留期來建立 Transient 的執行個體。Creates an instance of ServiceDescriptor with the specified service, implementationFactory, and the Transient lifetime.

Transient(Type, Type)

使用指定的 ServiceDescriptorserviceimplementationType 存留期來建立 Transient 的執行個體。Creates an instance of ServiceDescriptor with the specified service and implementationType and the Transient lifetime.

Transient<TService,TImplementation>()

使用指定的 ServiceDescriptorTServiceTImplementation 存留期來建立 Transient 的執行個體。Creates an instance of ServiceDescriptor with the specified TService, TImplementation, and the Transient lifetime.

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

使用指定的 ServiceDescriptorTServiceTImplementationimplementationFactory 存留期來建立 Transient 的執行個體。Creates an instance of ServiceDescriptor with the specified TService, TImplementation, implementationFactory, and the Transient lifetime.

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

使用指定的 ServiceDescriptorTServiceimplementationFactory 存留期來建立 Transient 的執行個體。Creates an instance of ServiceDescriptor with the specified TService, implementationFactory, and the Transient lifetime.

適用於