ServiceDescriptor.Describe Method

Definition

Overloads

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.

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

Source:
ServiceDescriptor.cs
Source:
ServiceDescriptor.cs

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

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

Parameters

serviceType
Type

The type of the service.

implementationFactory
Func<IServiceProvider,Object>

A factory to create new instances of the service implementation.

lifetime
ServiceLifetime

The lifetime of the service.

Returns

A new instance of ServiceDescriptor.

Applies to

.NET 9 (package-provided) og andre versioner
Produkt Versions
.NET 6 (package-provided), 7 (package-provided), 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)

Describe(Type, Type, ServiceLifetime)

Source:
ServiceDescriptor.cs
Source:
ServiceDescriptor.cs

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

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

Parameters

serviceType
Type

The type of the service.

implementationType
Type

The type of the implementation.

lifetime
ServiceLifetime

The lifetime of the service.

Returns

A new instance of ServiceDescriptor.

Applies to

.NET 9 (package-provided) og andre versioner
Produkt Versions
.NET 6 (package-provided), 7 (package-provided), 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)