共用方式為


ServiceCollectionMap.TryAddEnumerable 方法

定義

多載

TryAddEnumerable(Type, Type, ServiceLifetime)

將指定具體型別所實作的服務新增至實作指定合約的服務清單。 只有在集合不包含相同服務和實作類型的其他註冊時,才會新增服務。

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

將指定處理站所實作的服務新增至實作指定合約的服務清單。 只有在集合不包含相同服務和實作類型的其他註冊時,才會新增服務。

TryAddEnumerable(Type, Type, ServiceLifetime)

將指定具體型別所實作的服務新增至實作指定合約的服務清單。 只有在集合不包含相同服務和實作類型的其他註冊時,才會新增服務。

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

參數

serviceType
Type

服務的合約。

implementationType
Type

實作服務的具體型別。

lifetime
ServiceLifetime

服務存留期。

傳回

對應,以便進一步呼叫可以鏈結。

適用於

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

將指定處理站所實作的服務新增至實作指定合約的服務清單。 只有在集合不包含相同服務和實作類型的其他註冊時,才會新增服務。

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

參數

serviceType
Type

服務的合約。

implementationType
Type

實作服務的具體型別。

factory
Func<IServiceProvider,Object>

實作此服務的處理站。

lifetime
ServiceLifetime

服務存留期。

傳回

對應,以便進一步呼叫可以鏈結。

適用於