Share via


ServiceCollectionMap 類別

定義

透過 提供地圖 IServiceCollection ,讓 ServiceDescriptor 專案在每次完成時,都能有條件地新增或重新撰寫專案,而不需要對服務集合進行線性掃描。

public class ServiceCollectionMap : Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<Microsoft.EntityFrameworkCore.Internal.InternalServiceCollectionMap>
public class ServiceCollectionMap : Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<Microsoft.EntityFrameworkCore.Infrastructure.IInternalServiceCollectionMap>
type ServiceCollectionMap = class
    interface IInfrastructure<InternalServiceCollectionMap>
type ServiceCollectionMap = class
    interface IInfrastructure<IInternalServiceCollectionMap>
Public Class ServiceCollectionMap
Implements IInfrastructure(Of InternalServiceCollectionMap)
Public Class ServiceCollectionMap
Implements IInfrastructure(Of IInternalServiceCollectionMap)
繼承
ServiceCollectionMap
實作
IInfrastructure<Microsoft.EntityFrameworkCore.Internal.InternalServiceCollectionMap> IInfrastructure<IInternalServiceCollectionMap>

備註

請注意,當集合由地圖管理時,不應該以其他方式修改集合。 使用地圖進行修改之後,集合可以正常方式使用。

如需詳細資訊和範例,請參閱 資料庫提供者和延伸模組的實作

建構函式

ServiceCollectionMap(IServiceCollection)

建立新的 ServiceCollectionMap ,以在指定的 IServiceCollection 上操作。

屬性

ServiceCollection

基礎 IServiceCollection

方法

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

如果指定的服務類型尚未註冊任何服務,則加入指定處理站所實作的服務。

TryAdd(Type, Type, ServiceLifetime)

如果指定的服務類型尚未註冊任何服務,則加入由指定具體型別實作的服務。

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

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

TryAddEnumerable(Type, Type, ServiceLifetime)

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

TryAddScoped(Type, Func<IServiceProvider,Object>)

Scoped如果指定的服務類型尚未註冊任何服務,則加入指定處理站所實作的服務。

TryAddScoped(Type, Type)

Scoped如果指定的服務類型尚未註冊任何服務,則加入由指定具體型別實作的服務。

TryAddScoped<TService,TImplementation>()

Scoped如果指定的服務類型尚未註冊任何服務,則加入由指定具體型別實作的服務。

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

Scoped如果指定的服務類型尚未註冊任何服務,則加入指定處理站所實作的服務。

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

Scoped如果指定的服務類型尚未註冊任何服務,則加入指定處理站所實作的服務。

TryAddScopedEnumerable(Type, Type)

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

TryAddScopedEnumerable<TService,TImplementation>()

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

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

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

TryAddSingleton(Type, Func<IServiceProvider,Object>)

Singleton如果指定的服務類型尚未註冊任何服務,則加入指定處理站所實作的服務。

TryAddSingleton(Type, Object)

Singleton如果指定的服務類型尚未註冊任何服務,則加入指定實例所實作的服務。

TryAddSingleton(Type, Type)

Singleton如果指定的服務類型尚未註冊任何服務,則加入由指定具體型別實作的服務。

TryAddSingleton<TService,TImplementation>()

Singleton如果指定的服務類型尚未註冊任何服務,則加入由指定具體型別實作的服務。

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

Singleton如果指定的服務類型尚未註冊任何服務,則加入指定處理站所實作的服務。

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

Singleton如果指定的服務類型尚未註冊任何服務,則加入指定處理站所實作的服務。

TryAddSingleton<TService>(TService)

Singleton如果指定的服務類型尚未註冊任何服務,則加入指定實例所實作的服務。

TryAddSingletonEnumerable(Type, Object)

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

TryAddSingletonEnumerable(Type, Type)

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

TryAddSingletonEnumerable<TService,TImplementation>()

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

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

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

TryAddSingletonEnumerable<TService>(TService)

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

TryAddTransient(Type, Func<IServiceProvider,Object>)

Transient如果指定的服務類型尚未註冊任何服務,則加入指定處理站所實作的服務。

TryAddTransient(Type, Type)

Transient如果指定的服務類型尚未註冊任何服務,則加入由指定具體型別實作的服務。

TryAddTransient<TService,TImplementation>()

Transient如果指定的服務類型尚未註冊任何服務,則加入由指定具體型別實作的服務。

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

Transient如果指定的服務類型尚未註冊任何服務,則加入指定處理站所實作的服務。

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

Transient如果指定的服務類型尚未註冊任何服務,則加入指定處理站所實作的服務。

TryAddTransientEnumerable(Type, Type)

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

TryAddTransientEnumerable<TService,TImplementation>()

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

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

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

明確介面實作

IInfrastructure<IInternalServiceCollectionMap>.Instance

透過 提供地圖 IServiceCollection ,讓 ServiceDescriptor 專案在每次完成時,都能有條件地新增或重新撰寫專案,而不需要對服務集合進行線性掃描。

IInfrastructure<InternalServiceCollectionMap>.Instance

透過 提供地圖 IServiceCollection ,讓 ServiceDescriptor 專案在每次完成時,都能有條件地新增或重新撰寫專案,而不需要對服務集合進行線性掃描。

擴充方法

GetInfrastructure<T>(IInfrastructure<T>)

從使用 IInfrastructure<T> 隱藏的屬性取得值。

這個方法通常由資料庫提供者使用, (和其他延伸模組) 。 它通常不會用於應用程式程式碼中。

適用於