語言

ServiceCollectionMap 類別

定義

提供一個映射, IServiceCollection 允許 ServiceDescriptor 有條件地新增或重寫條目,且每次都不需要線性掃描服務集合。

[System.Runtime.CompilerServices.Nullable(0)]
public class ServiceCollectionMap : Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<Microsoft.EntityFrameworkCore.Infrastructure.IInternalServiceCollectionMap>
public class ServiceCollectionMap : Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<Microsoft.EntityFrameworkCore.Internal.InternalServiceCollectionMap>
public class ServiceCollectionMap : Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<Microsoft.EntityFrameworkCore.Infrastructure.IInternalServiceCollectionMap>
[<System.Runtime.CompilerServices.Nullable(0)>]
type ServiceCollectionMap = class
    interface IInfrastructure<IInternalServiceCollectionMap>
type ServiceCollectionMap = class
    interface IInfrastructure<InternalServiceCollectionMap>
type ServiceCollectionMap = class
    interface IInfrastructure<IInternalServiceCollectionMap>
Public Class ServiceCollectionMap
Implements IInfrastructure(Of IInternalServiceCollectionMap)
Public Class ServiceCollectionMap
Implements IInfrastructure(Of InternalServiceCollectionMap)
繼承
ServiceCollectionMap
屬性
實作
IInfrastructure<IInternalServiceCollectionMap> IInfrastructure<Microsoft.EntityFrameworkCore.Internal.InternalServiceCollectionMap>

備註

請注意,在地圖管理期間,該集合不應未經其他方式修改。 完成地圖修改後,該收藏可正常使用。

更多資訊與範例請參見 資料庫提供者與擴充功能的實作 。

建構函式

名稱 Description
ServiceCollectionMap(IServiceCollection)

建立一個 ServiceCollectionMap 新的 來操作給定 IServiceCollection的 。

屬性

名稱 Description
ServiceCollection

底層 IServiceCollection的 。

方法

名稱 Description
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 該工廠實作的服務加入執行該合約的服務清單中。 只有當該集合沒有其他相同服務及實作類型的註冊時,才會新增該服務。

明確介面實作

名稱 Description
IInfrastructure<IInternalServiceCollectionMap>.Instance

提供一個映射, IServiceCollection 允許 ServiceDescriptor 有條件地新增或重寫條目,且每次都不需要線性掃描服務集合。

IInfrastructure<InternalServiceCollectionMap>.Instance

提供一個映射, IServiceCollection 允許 ServiceDescriptor 有條件地新增或重寫條目,且每次都不需要線性掃描服務集合。

擴充方法

名稱 Description
GetInfrastructure<T>(IInfrastructure<T>)

從一個被隱藏的屬性中取得價值 IInfrastructure<T>。

此方法通常由資料庫提供者(及其他擴充)使用。 它通常不被用於應用程式程式碼中。

適用於