ServiceCollectionMap.TryAddTransient 方法

定义

重载

TryAddTransient(Type, Func<IServiceProvider,Object>)

Transient如果尚未为给定服务类型注册任何服务,则添加由给定工厂实现的服务。

TryAddTransient(Type, Type)

Transient如果尚未为给定服务类型注册任何服务,则添加由给定具体类型实现的服务。

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

Transient如果尚未为给定服务类型注册任何服务,则添加由给定工厂实现的服务。

TryAddTransient<TService,TImplementation>()

Transient如果尚未为给定服务类型注册任何服务,则添加由给定具体类型实现的服务。

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

Transient如果尚未为给定服务类型注册任何服务,则添加由给定工厂实现的服务。

TryAddTransient(Type, Func<IServiceProvider,Object>)

Source:
ServiceCollectionMap.cs
Source:
ServiceCollectionMap.cs
Source:
ServiceCollectionMap.cs
Source:
ServiceCollectionMap.cs
Source:
ServiceCollectionMap.cs
Source:
ServiceCollectionMap.cs
Source:
ServiceCollectionMap.cs
Source:
ServiceCollectionMap.cs
Source:
ServiceCollectionMap.cs

Transient如果尚未为给定服务类型注册任何服务,则添加由给定工厂实现的服务。

public virtual Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap TryAddTransient (Type serviceType, Func<IServiceProvider,object> factory);
abstract member TryAddTransient : Type * Func<IServiceProvider, obj> -> Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap
override this.TryAddTransient : Type * Func<IServiceProvider, obj> -> Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap
Public Overridable Function TryAddTransient (serviceType As Type, factory As Func(Of IServiceProvider, Object)) As ServiceCollectionMap

参数

serviceType
Type

服务的协定。

factory
Func<IServiceProvider,Object>

实现服务的工厂。

返回

映射,以便进一步的调用可以链接。

适用于

TryAddTransient(Type, Type)

Source:
ServiceCollectionMap.cs
Source:
ServiceCollectionMap.cs
Source:
ServiceCollectionMap.cs
Source:
ServiceCollectionMap.cs
Source:
ServiceCollectionMap.cs
Source:
ServiceCollectionMap.cs
Source:
ServiceCollectionMap.cs
Source:
ServiceCollectionMap.cs
Source:
ServiceCollectionMap.cs

Transient如果尚未为给定服务类型注册任何服务,则添加由给定具体类型实现的服务。

public virtual Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap TryAddTransient (Type serviceType, Type implementationType);
abstract member TryAddTransient : Type * Type -> Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap
override this.TryAddTransient : Type * Type -> Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap
Public Overridable Function TryAddTransient (serviceType As Type, implementationType As Type) As ServiceCollectionMap

参数

serviceType
Type

服务的协定。

implementationType
Type

实现服务的具体类型。

返回

映射,以便进一步的调用可以链接。

适用于

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

Source:
ServiceCollectionMap.cs
Source:
ServiceCollectionMap.cs
Source:
ServiceCollectionMap.cs
Source:
ServiceCollectionMap.cs
Source:
ServiceCollectionMap.cs
Source:
ServiceCollectionMap.cs
Source:
ServiceCollectionMap.cs
Source:
ServiceCollectionMap.cs
Source:
ServiceCollectionMap.cs

Transient如果尚未为给定服务类型注册任何服务,则添加由给定工厂实现的服务。

public virtual Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap TryAddTransient<TService,TImplementation> (Func<IServiceProvider,TImplementation> factory) where TService : class where TImplementation : class, TService;
abstract member TryAddTransient : Func<IServiceProvider, #'Service> -> Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap (requires 'Service : null)
override this.TryAddTransient : Func<IServiceProvider, #'Service> -> Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap (requires 'Service : null)
Public Overridable Function TryAddTransient(Of TService As Class, TImplementation As Class) (factory As Func(Of IServiceProvider, TImplementation)) As ServiceCollectionMap

类型参数

TService

服务的协定。

TImplementation

给定工厂创建的具体类型。

参数

factory
Func<IServiceProvider,TImplementation>

实现服务的工厂。

返回

映射,以便进一步的调用可以链接。

适用于

TryAddTransient<TService,TImplementation>()

Source:
ServiceCollectionMap.cs
Source:
ServiceCollectionMap.cs
Source:
ServiceCollectionMap.cs
Source:
ServiceCollectionMap.cs
Source:
ServiceCollectionMap.cs
Source:
ServiceCollectionMap.cs
Source:
ServiceCollectionMap.cs
Source:
ServiceCollectionMap.cs
Source:
ServiceCollectionMap.cs

Transient如果尚未为给定服务类型注册任何服务,则添加由给定具体类型实现的服务。

public virtual Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap TryAddTransient<TService,TImplementation> () where TService : class where TImplementation : class, TService;
abstract member TryAddTransient : unit -> Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap (requires 'Service : null)
override this.TryAddTransient : unit -> Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap (requires 'Service : null)
Public Overridable Function TryAddTransient(Of TService As Class, TImplementation As Class) () As ServiceCollectionMap

类型参数

TService

服务的协定。

TImplementation

实现服务的具体类型。

返回

映射,以便进一步的调用可以链接。

适用于

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

Source:
ServiceCollectionMap.cs
Source:
ServiceCollectionMap.cs
Source:
ServiceCollectionMap.cs
Source:
ServiceCollectionMap.cs
Source:
ServiceCollectionMap.cs
Source:
ServiceCollectionMap.cs
Source:
ServiceCollectionMap.cs
Source:
ServiceCollectionMap.cs
Source:
ServiceCollectionMap.cs

Transient如果尚未为给定服务类型注册任何服务,则添加由给定工厂实现的服务。

public virtual Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap TryAddTransient<TService> (Func<IServiceProvider,TService> factory) where TService : class;
abstract member TryAddTransient : Func<IServiceProvider, 'Service (requires 'Service : null)> -> Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap (requires 'Service : null)
override this.TryAddTransient : Func<IServiceProvider, 'Service (requires 'Service : null)> -> Microsoft.EntityFrameworkCore.Infrastructure.ServiceCollectionMap (requires 'Service : null)
Public Overridable Function TryAddTransient(Of TService As Class) (factory As Func(Of IServiceProvider, TService)) As ServiceCollectionMap

类型参数

TService

服务的协定。

参数

factory
Func<IServiceProvider,TService>

实现服务的工厂。

返回

映射,以便进一步的调用可以链接。

适用于