ServiceDescriptor.Transient 方法

定义

重载

Transient(Type, Func<IServiceProvider,Object>)

创建具有指定 serviceimplementationFactoryTransient 生存期的 ServiceDescriptor 实例。

Transient(Type, Type)

创建具有指定 serviceimplementationTypeTransient 生存期的 ServiceDescriptor 实例。

Transient<TService,TImplementation>()

创建具有指定 TServiceTImplementationTransient 生存期的 ServiceDescriptor 实例。

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

创建具有指定 TServiceTImplementationimplementationFactoryTransient 生存期的 ServiceDescriptor 实例。

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

创建具有指定 TServiceimplementationFactoryTransient 生存期的 ServiceDescriptor 实例。

Transient(Type, Func<IServiceProvider,Object>)

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

创建具有指定 serviceimplementationFactoryTransient 生存期的 ServiceDescriptor 实例。

public:
 static Microsoft::Extensions::DependencyInjection::ServiceDescriptor ^ Transient(Type ^ service, Func<IServiceProvider ^, System::Object ^> ^ implementationFactory);
public static Microsoft.Extensions.DependencyInjection.ServiceDescriptor Transient (Type service, Func<IServiceProvider,object> implementationFactory);
static member Transient : Type * Func<IServiceProvider, obj> -> Microsoft.Extensions.DependencyInjection.ServiceDescriptor
Public Shared Function Transient (service As Type, implementationFactory As Func(Of IServiceProvider, Object)) As ServiceDescriptor

参数

service
Type

服务的类型。

implementationFactory
Func<IServiceProvider,Object>

用于创建服务实现的新实例的工厂。

返回

ServiceDescriptor 的新实例。

适用于

Transient(Type, Type)

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

创建具有指定 serviceimplementationTypeTransient 生存期的 ServiceDescriptor 实例。

public:
 static Microsoft::Extensions::DependencyInjection::ServiceDescriptor ^ Transient(Type ^ service, Type ^ implementationType);
public static Microsoft.Extensions.DependencyInjection.ServiceDescriptor Transient (Type service, Type implementationType);
static member Transient : Type * Type -> Microsoft.Extensions.DependencyInjection.ServiceDescriptor
Public Shared Function Transient (service As Type, implementationType As Type) As ServiceDescriptor

参数

service
Type

服务的类型。

implementationType
Type

实现的类型。

返回

ServiceDescriptor 的新实例。

适用于

Transient<TService,TImplementation>()

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

创建具有指定 TServiceTImplementationTransient 生存期的 ServiceDescriptor 实例。

public:
generic <typename TService, typename TImplementation>
 where TService : class where TImplementation : class, TService static Microsoft::Extensions::DependencyInjection::ServiceDescriptor ^ Transient();
public static Microsoft.Extensions.DependencyInjection.ServiceDescriptor Transient<TService,TImplementation> () where TService : class where TImplementation : class, TService;
static member Transient : unit -> Microsoft.Extensions.DependencyInjection.ServiceDescriptor (requires 'Service : null)
Public Shared Function Transient(Of TService As Class, TImplementation As Class) () As ServiceDescriptor

类型参数

TService

服务的类型。

TImplementation

实现的类型。

返回

ServiceDescriptor 的新实例。

适用于

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

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

创建具有指定 TServiceTImplementationimplementationFactoryTransient 生存期的 ServiceDescriptor 实例。

public:
generic <typename TService, typename TImplementation>
 where TService : class where TImplementation : class, TService static Microsoft::Extensions::DependencyInjection::ServiceDescriptor ^ Transient(Func<IServiceProvider ^, TImplementation> ^ implementationFactory);
public static Microsoft.Extensions.DependencyInjection.ServiceDescriptor Transient<TService,TImplementation> (Func<IServiceProvider,TImplementation> implementationFactory) where TService : class where TImplementation : class, TService;
static member Transient : Func<IServiceProvider, #'Service> -> Microsoft.Extensions.DependencyInjection.ServiceDescriptor (requires 'Service : null)
Public Shared Function Transient(Of TService As Class, TImplementation As Class) (implementationFactory As Func(Of IServiceProvider, TImplementation)) As ServiceDescriptor

类型参数

TService

服务的类型。

TImplementation

实现的类型。

参数

implementationFactory
Func<IServiceProvider,TImplementation>

用于创建服务实现的新实例的工厂。

返回

ServiceDescriptor 的新实例。

适用于

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

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

创建具有指定 TServiceimplementationFactoryTransient 生存期的 ServiceDescriptor 实例。

public:
generic <typename TService>
 where TService : class static Microsoft::Extensions::DependencyInjection::ServiceDescriptor ^ Transient(Func<IServiceProvider ^, TService> ^ implementationFactory);
public static Microsoft.Extensions.DependencyInjection.ServiceDescriptor Transient<TService> (Func<IServiceProvider,TService> implementationFactory) where TService : class;
static member Transient : Func<IServiceProvider, 'Service (requires 'Service : null)> -> Microsoft.Extensions.DependencyInjection.ServiceDescriptor (requires 'Service : null)
Public Shared Function Transient(Of TService As Class) (implementationFactory As Func(Of IServiceProvider, TService)) As ServiceDescriptor

类型参数

TService

服务的类型。

参数

implementationFactory
Func<IServiceProvider,TService>

用于创建服务实现的新实例的工厂。

返回

ServiceDescriptor 的新实例。

适用于