ServiceDescriptor Constructors

Definition

Overloads

ServiceDescriptor(Type, Object)

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

ServiceDescriptor(Type, Func<IServiceProvider,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, Type, ServiceLifetime)

Initializes a new instance of ServiceDescriptor with the specified implementationType.

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

Initializes a new instance of ServiceDescriptor with the specified factory.

ServiceDescriptor(Type, Object, Type, ServiceLifetime)

Initializes a new instance of ServiceDescriptor with the specified implementationType.

ServiceDescriptor(Type, Object)

Source:
ServiceDescriptor.cs
Source:
ServiceDescriptor.cs
Source:
ServiceDescriptor.cs

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

public ServiceDescriptor (Type serviceType, object instance);

Parameters

serviceType
Type

The Type of the service.

instance
Object

The instance implementing the service.

Applies to

.NET 9 (package-provided) e altre versioni
Prodotto Versioni
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided), 2.1 (package-provided)

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

Source:
ServiceDescriptor.cs
Source:
ServiceDescriptor.cs
Source:
ServiceDescriptor.cs

Initializes a new instance of ServiceDescriptor with the specified factory.

public ServiceDescriptor (Type serviceType, Func<IServiceProvider,object> factory, Microsoft.Extensions.DependencyInjection.ServiceLifetime lifetime);

Parameters

serviceType
Type

The Type of the service.

factory
Func<IServiceProvider,Object>

A factory used for creating service instances.

lifetime
ServiceLifetime

The ServiceLifetime of the service.

Applies to

.NET 9 (package-provided) e altre versioni
Prodotto Versioni
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided), 2.1 (package-provided)

ServiceDescriptor(Type, Object, Object)

Source:
ServiceDescriptor.cs
Source:
ServiceDescriptor.cs
Source:
ServiceDescriptor.cs

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

public ServiceDescriptor (Type serviceType, object? serviceKey, object instance);

Parameters

serviceType
Type

The Type of the service.

serviceKey
Object

The ServiceKey of the service.

instance
Object

The instance implementing the service.

Applies to

.NET 9 (package-provided) e altre versioni
Prodotto Versioni
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided), 2.1 (package-provided)

ServiceDescriptor(Type, Type, ServiceLifetime)

Source:
ServiceDescriptor.cs
Source:
ServiceDescriptor.cs
Source:
ServiceDescriptor.cs

Initializes a new instance of ServiceDescriptor with the specified implementationType.

public ServiceDescriptor (Type serviceType, Type implementationType, Microsoft.Extensions.DependencyInjection.ServiceLifetime lifetime);

Parameters

serviceType
Type

The Type of the service.

implementationType
Type

The Type implementing the service.

lifetime
ServiceLifetime

The ServiceLifetime of the service.

Applies to

.NET 9 (package-provided) e altre versioni
Prodotto Versioni
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided), 2.1 (package-provided)

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

Source:
ServiceDescriptor.cs
Source:
ServiceDescriptor.cs
Source:
ServiceDescriptor.cs

Initializes a new instance of ServiceDescriptor with the specified factory.

public ServiceDescriptor (Type serviceType, object? serviceKey, Func<IServiceProvider,object?,object> factory, Microsoft.Extensions.DependencyInjection.ServiceLifetime lifetime);

Parameters

serviceType
Type

The Type of the service.

serviceKey
Object

The ServiceKey of the service.

factory
Func<IServiceProvider,Object,Object>

A factory used for creating service instances.

lifetime
ServiceLifetime

The ServiceLifetime of the service.

Applies to

.NET 9 (package-provided) e altre versioni
Prodotto Versioni
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided), 2.1 (package-provided)

ServiceDescriptor(Type, Object, Type, ServiceLifetime)

Source:
ServiceDescriptor.cs
Source:
ServiceDescriptor.cs
Source:
ServiceDescriptor.cs

Initializes a new instance of ServiceDescriptor with the specified implementationType.

public ServiceDescriptor (Type serviceType, object? serviceKey, Type implementationType, Microsoft.Extensions.DependencyInjection.ServiceLifetime lifetime);

Parameters

serviceType
Type

The Type of the service.

serviceKey
Object

The ServiceKey of the service.

implementationType
Type

The Type implementing the service.

lifetime
ServiceLifetime

The ServiceLifetime of the service.

Applies to

.NET 9 (package-provided) e altre versioni
Prodotto Versioni
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided), 2.1 (package-provided)