共用方式為


ServiceDescriptor Class

Definition

Describes a service with its service type, implementation, and lifetime.

public ref class ServiceDescriptor
public class ServiceDescriptor
type ServiceDescriptor = class
Public Class ServiceDescriptor
Inheritance
ServiceDescriptor

Constructors

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

Initializes a new instance of ServiceDescriptor with the specified factory.

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

Initializes a new instance of ServiceDescriptor with the specified factory.

ServiceDescriptor(Type, Object, Object)

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

ServiceDescriptor(Type, Object, Type, ServiceLifetime)

Initializes a new instance of ServiceDescriptor with the specified implementationType.

ServiceDescriptor(Type, Object)

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

ServiceDescriptor(Type, Type, ServiceLifetime)

Initializes a new instance of ServiceDescriptor with the specified implementationType.

Properties

ImplementationFactory

Gets the factory used for creating service instance, or returns null if IsKeyedService is true.

ImplementationInstance

Gets the instance that implements the service, or returns null if IsKeyedService is true.

ImplementationType

Gets the Type that implements the service, or returns null if IsKeyedService is true.

IsKeyedService

Indicates whether the service is a keyed service.

KeyedImplementationFactory

Gets the factory used for creating Keyed service instances, or throws InvalidOperationException if IsKeyedService is false.

KeyedImplementationInstance

Gets the instance that implements the service, or throws InvalidOperationException if IsKeyedService is false.

KeyedImplementationType

Gets the Type that implements the service, or throws InvalidOperationException if IsKeyedService is false.

Lifetime

Gets the ServiceLifetime of the service.

ServiceKey

Get the key of the service, if applicable.

ServiceType

Gets the Type of the service.

Methods

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

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

Describe(Type, Type, ServiceLifetime)

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

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

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

DescribeKeyed(Type, Object, Type, ServiceLifetime)

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.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
KeyedScoped(Type, Object, Func<IServiceProvider,Object,Object>)

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

KeyedScoped(Type, Object, Type)

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

KeyedScoped<TService,TImplementation>(Object, Func<IServiceProvider,Object,TImplementation>)

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

KeyedScoped<TService,TImplementation>(Object)

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

KeyedScoped<TService>(Object, Func<IServiceProvider,Object,TService>)

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

KeyedSingleton(Type, Object, Func<IServiceProvider,Object,Object>)

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

KeyedSingleton(Type, Object, Object)

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

KeyedSingleton(Type, Object, Type)

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

KeyedSingleton<TService,TImplementation>(Object, Func<IServiceProvider,Object,TImplementation>)

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

KeyedSingleton<TService,TImplementation>(Object)

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

KeyedSingleton<TService>(Object, Func<IServiceProvider,Object,TService>)

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

KeyedSingleton<TService>(Object, TService)

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

KeyedTransient(Type, Object, Func<IServiceProvider,Object,Object>)

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

KeyedTransient(Type, Object, Type)

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

KeyedTransient<TService,TImplementation>(Object, Func<IServiceProvider,Object,TImplementation>)

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

KeyedTransient<TService,TImplementation>(Object)

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

KeyedTransient<TService>(Object, Func<IServiceProvider,Object,TService>)

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

MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
Scoped(Type, Func<IServiceProvider,Object>)

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

Scoped(Type, Type)

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

Scoped<TService,TImplementation>()

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

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

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

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

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

Singleton(Type, Func<IServiceProvider,Object>)

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

Singleton(Type, Object)

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

Singleton(Type, Type)

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

Singleton<TService,TImplementation>()

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

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

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

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

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

Singleton<TService>(TService)

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

ToString()

Returns a string that represents the current object.

Transient(Type, Func<IServiceProvider,Object>)

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

Transient(Type, Type)

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

Transient<TService,TImplementation>()

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

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

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

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

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

Applies to