IServiceCollection 介面

定義

指定服務描述項集合的合約。

public interface class IServiceCollection : System::Collections::Generic::ICollection<Microsoft::Extensions::DependencyInjection::ServiceDescriptor ^>, System::Collections::Generic::IEnumerable<Microsoft::Extensions::DependencyInjection::ServiceDescriptor ^>, System::Collections::Generic::IList<Microsoft::Extensions::DependencyInjection::ServiceDescriptor ^>
public interface IServiceCollection : System.Collections.Generic.ICollection<Microsoft.Extensions.DependencyInjection.ServiceDescriptor>, System.Collections.Generic.IEnumerable<Microsoft.Extensions.DependencyInjection.ServiceDescriptor>, System.Collections.Generic.IList<Microsoft.Extensions.DependencyInjection.ServiceDescriptor>
type IServiceCollection = interface
    interface IList<ServiceDescriptor>
    interface ICollection<ServiceDescriptor>
    interface seq<ServiceDescriptor>
    interface IEnumerable
type IServiceCollection = interface
    interface ICollection<ServiceDescriptor>
    interface seq<ServiceDescriptor>
    interface IEnumerable
    interface IList<ServiceDescriptor>
Public Interface IServiceCollection
Implements ICollection(Of ServiceDescriptor), IEnumerable(Of ServiceDescriptor), IList(Of ServiceDescriptor)
衍生
實作

屬性

Count

取得 ICollection<T> 中所包含的項目數。

(繼承來源 ICollection<T>)
IsReadOnly

取得值,指出 ICollection<T> 是否唯讀。

(繼承來源 ICollection<T>)
Item[Int32]

在指定的索引位置上取得或設定項目。

(繼承來源 IList<T>)

方法

Add(T)

將項目加入至 ICollection<T>

(繼承來源 ICollection<T>)
Clear()

ICollection<T> 中移除所有項目。

(繼承來源 ICollection<T>)
Contains(T)

判斷 ICollection<T> 是否包含特定值。

(繼承來源 ICollection<T>)
CopyTo(T[], Int32)

從特定的 ICollection<T> 索引開始,將 Array 的項目複製到 Array

(繼承來源 ICollection<T>)
GetEnumerator()

傳回逐一查看集合的列舉值。

(繼承來源 IEnumerable)
IndexOf(T)

判斷 IList<T> 中指定項目的索引。

(繼承來源 IList<T>)
Insert(Int32, T)

將項目插入位於指定索引的 IList<T>

(繼承來源 IList<T>)
Remove(T)

ICollection<T> 移除特定物件之第一個符合的元素。

(繼承來源 ICollection<T>)
RemoveAt(Int32)

移除在指定索引處的 IList<T> 項目。

(繼承來源 IList<T>)

擴充方法

AddServiceLogEnricher(IServiceCollection)

將服務擴充器的實體加入至 IServiceCollection

AddServiceLogEnricher(IServiceCollection, IConfigurationSection)

將服務擴充器的實體加入至 IServiceCollection

AddServiceLogEnricher(IServiceCollection, Action<ApplicationLogEnricherOptions>)

將服務擴充器的實體加入至 IServiceCollection

AddApplicationMetadata(IServiceCollection, IConfigurationSection)

將的 ApplicationMetadata 實例加入至相依性插入容器。

AddApplicationMetadata(IServiceCollection, Action<ApplicationMetadata>)

將的 ApplicationMetadata 實例加入至相依性插入容器。

AddAsyncState(IServiceCollection)

新增、 IAsyncContext<T>Microsoft.Extensions.AsyncState.IAsyncLocalContext`1 服務的預設實作IAsyncState。 請注意,這些介面的實作不是安全線程。

ActivateKeyedSingleton(IServiceCollection, Type, Object)

在啟動時,而不是在運行時間強制執行金鑰單一啟用。

ActivateKeyedSingleton<TService>(IServiceCollection, Object)

在啟動時,而不是在運行時間強制執行金鑰單一啟用。

ActivateSingleton(IServiceCollection, Type)

在啟動時強制執行單一啟用,而不是在運行時間啟用。

ActivateSingleton<TService>(IServiceCollection)

在啟動時強制執行單一啟用,而不是在運行時間啟用。

AddActivatedKeyedSingleton(IServiceCollection, Type, Object)

新增自動啟用的金鑰單一服務。

AddActivatedKeyedSingleton(IServiceCollection, Type, Object, Func<IServiceProvider,Object,Object>)

新增自動啟用的金鑰單一服務。

AddActivatedKeyedSingleton(IServiceCollection, Type, Object, Type)

新增自動啟用的金鑰單一服務。

AddActivatedKeyedSingleton<TService>(IServiceCollection, Object)

新增自動啟用的金鑰單一服務。

AddActivatedKeyedSingleton<TService>(IServiceCollection, Object, Func<IServiceProvider,Object,TService>)

新增自動啟用的金鑰單一服務。

AddActivatedKeyedSingleton<TService,TImplementation>(IServiceCollection, Object)

新增自動啟用的金鑰單一服務。

AddActivatedKeyedSingleton<TService,TImplementation>(IServiceCollection, Object, Func<IServiceProvider,Object,TImplementation>)

新增自動啟用的金鑰單一服務。

AddActivatedSingleton(IServiceCollection, Type)

將 serviceType 中所指定類型的自動啟動單一服務新增至指定的 IServiceCollection

AddActivatedSingleton(IServiceCollection, Type, Func<IServiceProvider,Object>)

新增自動啟用的單一服務。

AddActivatedSingleton(IServiceCollection, Type, Type)

新增自動啟用的單一服務。

AddActivatedSingleton<TService>(IServiceCollection)

新增自動啟用的單一服務。

AddActivatedSingleton<TService>(IServiceCollection, Func<IServiceProvider,TService>)

新增自動啟用的單一服務。

AddActivatedSingleton<TService,TImplementation>(IServiceCollection)

新增自動啟用的單一服務。

AddActivatedSingleton<TService,TImplementation>(IServiceCollection, Func<IServiceProvider,TImplementation>)

新增自動啟用的單一服務。

TryAddActivatedKeyedSingleton(IServiceCollection, Type, Object)

嘗試新增自動啟用的金鑰單一服務。

TryAddActivatedKeyedSingleton(IServiceCollection, Type, Object, Func<IServiceProvider,Object,Object>)

嘗試新增自動啟用的金鑰單一服務。

TryAddActivatedKeyedSingleton(IServiceCollection, Type, Object, Type)

嘗試新增自動啟用的金鑰單一服務。

TryAddActivatedKeyedSingleton<TService>(IServiceCollection, Object)

嘗試新增自動啟用的金鑰單一服務。

TryAddActivatedKeyedSingleton<TService>(IServiceCollection, Object, Func<IServiceProvider,Object,TService>)

嘗試新增自動啟用的金鑰單一服務。

TryAddActivatedKeyedSingleton<TService,TImplementation>(IServiceCollection, Object)

嘗試新增自動啟用的金鑰單一服務。

TryAddActivatedSingleton(IServiceCollection, Type)

嘗試新增自動啟用的單一服務。

TryAddActivatedSingleton(IServiceCollection, Type, Func<IServiceProvider,Object>)

嘗試新增自動啟用的單一服務。

TryAddActivatedSingleton(IServiceCollection, Type, Type)

嘗試新增自動啟用的單一服務。

TryAddActivatedSingleton<TService>(IServiceCollection)

嘗試新增自動啟用的單一服務。

TryAddActivatedSingleton<TService>(IServiceCollection, Func<IServiceProvider,TService>)

嘗試新增自動啟用的單一服務。

TryAddActivatedSingleton<TService,TImplementation>(IServiceCollection)

嘗試新增自動啟用的單一服務。

AddTelemetryHealthCheckPublisher(IServiceCollection)

註冊健康情況檢查發行者,此發行者會發出代表應用程式健康情況的遙測。

AddTelemetryHealthCheckPublisher(IServiceCollection, IConfigurationSection)

註冊健康情況檢查發行者,此發行者會發出代表應用程式健康情況的遙測。

AddTelemetryHealthCheckPublisher(IServiceCollection, Action<TelemetryHealthCheckPublisherOptions>)

註冊健康情況檢查發行者,此發行者會發出代表應用程式健康情況的遙測。

AddContextualOptions(IServiceCollection)

新增使用關係型選項所需的服務。

Configure<TOptions>(IServiceCollection, Action<IOptionsContext,TOptions>)

註冊用來設定特定選項類型的動作。

Configure<TOptions>(IServiceCollection, Func<IOptionsContext,CancellationToken,ValueTask<IConfigureContextualOptions<TOptions>>>)

註冊用來設定特定選項類型的動作。

Configure<TOptions>(IServiceCollection, String, Action<IOptionsContext,TOptions>)

註冊用來設定特定選項類型的動作。

Configure<TOptions>(IServiceCollection, String, Func<IOptionsContext,CancellationToken,ValueTask<IConfigureContextualOptions<TOptions>>>)

註冊用來設定特定選項類型的動作。

PostConfigure<TOptions>(IServiceCollection, Action<IOptionsContext,TOptions>)

註冊用於初始化特定類型選項的動作。

PostConfigure<TOptions>(IServiceCollection, String, Action<IOptionsContext,TOptions>)

註冊用於初始化特定類型選項的動作。

PostConfigureAll<TOptions>(IServiceCollection, Action<IOptionsContext,TOptions>)

註冊用來初始化特定選項類型之所有實例的動作。

ValidateContextualOptions<TOptions>(IServiceCollection, Func<TOptions,Boolean>, String)

註冊選項類型的驗證動作。

ValidateContextualOptions<TOptions>(IServiceCollection, String, Func<TOptions,Boolean>, String)

註冊選項類型的驗證動作。

AddWebEncoders(IServiceCollection)

HtmlEncoderJavaScriptEncoderUrlEncoder 新增至指定的 services

AddWebEncoders(IServiceCollection, Action<WebEncoderOptions>)

HtmlEncoderJavaScriptEncoderUrlEncoder 新增至指定的 services

AddLogEnricher(IServiceCollection, ILogEnricher)

註冊記錄擴充器實例。

AddLogEnricher<T>(IServiceCollection)

註冊記錄擴充器類型。

AddStaticLogEnricher(IServiceCollection, IStaticLogEnricher)

註冊靜態記錄擴充器實例。

AddStaticLogEnricher<T>(IServiceCollection)

註冊靜態記錄擴充器類型。

AddExceptionSummarizer(IServiceCollection)

將例外狀況摘要器註冊至相依性插入容器。

AddExceptionSummarizer(IServiceCollection, Action<IExceptionSummarizationBuilder>)

將例外狀況摘要器註冊至相依性插入容器。

Add(IServiceCollection, ServiceDescriptor)

將指定的 descriptor 加入至 collection

Add(IServiceCollection, IEnumerable<ServiceDescriptor>)

ServiceDescriptor 的序列新增至 collection

RemoveAll(IServiceCollection, Type)

移除 IServiceCollectionserviceType 類型的所有服務。

RemoveAll<T>(IServiceCollection)

移除 IServiceCollectionT 類型的所有服務。

RemoveAllKeyed(IServiceCollection, Type, Object)

移除 collectionserviceType 類型的所有服務。

RemoveAllKeyed<T>(IServiceCollection, Object)

移除 collectionT 類型的所有服務。

Replace(IServiceCollection, ServiceDescriptor)

移除 IServiceCollection 中具有與 descriptor 相同服務類型的第一個服務,並將 descriptor 新增至集合。

TryAdd(IServiceCollection, ServiceDescriptor)

如果尚未註冊服務類型,則將指定的 descriptor 新增至 collection

TryAdd(IServiceCollection, IEnumerable<ServiceDescriptor>)

如果尚未註冊服務類型,則將指定的 descriptors 新增至 collection

TryAddEnumerable(IServiceCollection, ServiceDescriptor)

如果現有描述項具有相同的 ServiceType,以及尚未存在於 services 中的實作,則新增 ServiceDescriptor

TryAddEnumerable(IServiceCollection, IEnumerable<ServiceDescriptor>)

如果現有描述項具有相同的 ServiceType,以及尚未存在於 services 中的實作,則新增特定的 ServiceDescriptor

TryAddKeyedScoped(IServiceCollection, Type, Object)

如果尚未註冊服務類型,則將指定的 service 作為 Scoped 服務新增至 collection

TryAddKeyedScoped(IServiceCollection, Type, Object, Func<IServiceProvider,Object,Object>)

如果尚未註冊服務類型,則使用 implementationFactory 中指定的 Factory,將指定的 service 作為 Scoped 服務新增至 collection

TryAddKeyedScoped(IServiceCollection, Type, Object, Type)

如果尚未註冊服務類型,則將所指定 service 作為具有 implementationTypeScoped 服務新增至 collection

TryAddKeyedScoped<TService>(IServiceCollection, Object)

如果尚未註冊服務類型,則將指定的 TService 作為 Scoped 服務新增至 collection

TryAddKeyedScoped<TService>(IServiceCollection, Object, Func<IServiceProvider,Object,TService>)

如果尚未註冊服務類型,則使用 implementationFactory 中指定的 Factory,將指定的 TService 作為 Scoped 服務新增至 services

TryAddKeyedScoped<TService,TImplementation>(IServiceCollection, Object)

如果尚未註冊服務類型,則將指定 TService 作為 TImplementation 中指定的 Scoped 服務實作類型新增至 collection

TryAddKeyedSingleton(IServiceCollection, Type, Object)

如果尚未註冊服務類型,則將指定的 service 作為 Singleton 服務新增至 collection

TryAddKeyedSingleton(IServiceCollection, Type, Object, Func<IServiceProvider,Object,Object>)

如果尚未註冊服務類型,則使用 implementationFactory 中指定的 Factory,將指定的 service 作為 Singleton 服務新增至 collection

TryAddKeyedSingleton(IServiceCollection, Type, Object, Type)

如果尚未註冊服務類型,則將所指定 service 作為具有 implementationTypeSingleton 服務新增至 collection

TryAddKeyedSingleton<TService>(IServiceCollection, Object)

如果尚未註冊服務類型,則將指定的 TService 作為 Singleton 服務新增至 collection

TryAddKeyedSingleton<TService>(IServiceCollection, Object, TService)

如果尚未註冊服務類型,則使用 instance 中指定的執行個體,將指定的 TService 作為 Singleton 服務新增至 collection

TryAddKeyedSingleton<TService>(IServiceCollection, Object, Func<IServiceProvider,Object,TService>)

如果尚未註冊服務類型,則使用 implementationFactory 中指定的 Factory,將指定的 TService 作為 Singleton 服務新增至 services

TryAddKeyedSingleton<TService,TImplementation>(IServiceCollection, Object)

如果尚未註冊服務類型,則將指定 TService 作為 TImplementation 中指定的 Singleton 服務實作類型新增至 collection

TryAddKeyedTransient(IServiceCollection, Type, Object)

如果尚未註冊服務類型,則將指定的 service 作為 Transient 服務新增至 collection

TryAddKeyedTransient(IServiceCollection, Type, Object, Func<IServiceProvider,Object,Object>)

如果尚未註冊服務類型,則使用 implementationFactory 中指定的 Factory,將指定的 service 作為 Transient 服務新增至 collection

TryAddKeyedTransient(IServiceCollection, Type, Object, Type)

如果尚未註冊服務類型,則將所指定 service 作為具有 implementationTypeTransient 服務新增至 collection

TryAddKeyedTransient<TService>(IServiceCollection, Object)

如果尚未註冊服務類型,則將指定的 TService 作為 Transient 服務新增至 collection

TryAddKeyedTransient<TService>(IServiceCollection, Object, Func<IServiceProvider,Object,TService>)

如果尚未註冊服務類型,則使用 implementationFactory 中指定的 Factory,將指定的 TService 作為 Transient 服務新增至 services

TryAddKeyedTransient<TService,TImplementation>(IServiceCollection, Object)

如果尚未註冊服務類型,則將指定 TService 作為 TImplementation 中指定的 Transient 服務實作類型新增至 collection

TryAddScoped(IServiceCollection, Type)

如果尚未註冊服務類型,則將指定的 service 作為 Scoped 服務新增至 collection

TryAddScoped(IServiceCollection, Type, Func<IServiceProvider,Object>)

如果尚未註冊服務類型,則使用 implementationFactory 中指定的 Factory,將指定的 service 作為 Scoped 服務新增至 collection

TryAddScoped(IServiceCollection, Type, Type)

如果尚未註冊服務類型,則將所指定 service 作為具有 implementationTypeScoped 服務新增至 collection

TryAddScoped<TService>(IServiceCollection)

如果尚未註冊服務類型,則將指定的 TService 作為 Scoped 服務新增至 collection

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

如果尚未註冊服務類型,則使用 implementationFactory 中指定的 Factory,將指定的 TService 作為 Scoped 服務新增至 services

TryAddScoped<TService,TImplementation>(IServiceCollection)

如果尚未註冊服務類型,則將指定 TService 作為 TImplementation 中指定的 Scoped 服務實作類型新增至 collection

TryAddSingleton(IServiceCollection, Type)

如果尚未註冊服務類型,則將指定的 service 作為 Singleton 服務新增至 collection

TryAddSingleton(IServiceCollection, Type, Func<IServiceProvider,Object>)

如果尚未註冊服務類型,則使用 implementationFactory 中指定的 Factory,將指定的 service 作為 Singleton 服務新增至 collection

TryAddSingleton(IServiceCollection, Type, Type)

如果尚未註冊服務類型,則將所指定 service 作為具有 implementationTypeSingleton 服務新增至 collection

TryAddSingleton<TService>(IServiceCollection)

如果尚未註冊服務類型,則將指定的 TService 作為 Singleton 服務新增至 collection

TryAddSingleton<TService>(IServiceCollection, TService)

如果尚未註冊服務類型,則使用 instance 中指定的執行個體,將指定的 TService 作為 Singleton 服務新增至 collection

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

如果尚未註冊服務類型,則使用 implementationFactory 中指定的 Factory,將指定的 TService 作為 Singleton 服務新增至 services

TryAddSingleton<TService,TImplementation>(IServiceCollection)

如果尚未註冊服務類型,則將指定 TService 作為 TImplementation 中指定的 Singleton 服務實作類型新增至 collection

TryAddTransient(IServiceCollection, Type)

如果尚未註冊服務類型,則將指定的 service 作為 Transient 服務新增至 collection

TryAddTransient(IServiceCollection, Type, Func<IServiceProvider,Object>)

如果尚未註冊服務類型,則使用 implementationFactory 中指定的 Factory,將指定的 service 作為 Transient 服務新增至 collection

TryAddTransient(IServiceCollection, Type, Type)

如果尚未註冊服務類型,則將所指定 service 作為具有 implementationTypeTransient 服務新增至 collection

TryAddTransient<TService>(IServiceCollection)

如果尚未註冊服務類型,則將指定的 TService 作為 Transient 服務新增至 collection

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

如果尚未註冊服務類型,則使用 implementationFactory 中指定的 Factory,將指定的 TService 作為 Transient 服務新增至 services

TryAddTransient<TService,TImplementation>(IServiceCollection)

如果尚未註冊服務類型,則將指定 TService 作為 TImplementation 中指定的 Transient 服務實作類型新增至 collection

AddFakeLogging(IServiceCollection)

使用預設選項設定假記錄。

AddFakeLogging(IServiceCollection, IConfigurationSection)

設定假的記錄。

AddFakeLogging(IServiceCollection, Action<FakeLogCollectorOptions>)

設定假的記錄。

AddFakeRedaction(IServiceCollection)

註冊一律會傳回假的 Redactor 實例的假 Redactor 提供者。

AddFakeRedaction(IServiceCollection, Action<FakeRedactorOptions>)

註冊一律會傳回假的 Redactor 實例的假 Redactor 提供者。

AddHealthChecks(IServiceCollection)

使用提供的委派來註冊健康狀態檢查,以將 HealthCheckService 新增至容器。

AddHttpClient(IServiceCollection)

IHttpClientFactory 和相關服務新增至 IServiceCollection

AddHttpClient(IServiceCollection, String)

IHttpClientFactory 和相關服務新增至 IServiceCollection,並設定具名 HttpClient

AddHttpClient(IServiceCollection, String, Action<IServiceProvider,HttpClient>)

IHttpClientFactory 和相關服務新增至 IServiceCollection,並設定具名 HttpClient

AddHttpClient(IServiceCollection, String, Action<HttpClient>)

IHttpClientFactory 和相關服務新增至 IServiceCollection,並設定具名 HttpClient

AddHttpClient<TClient>(IServiceCollection)

IHttpClientFactory 和相關服務新增至 IServiceCollection,並設定 TClient 類型與具名 HttpClient 之間的繫結。 用戶端名稱將會設定為 TClient 的完整名稱。

AddHttpClient<TClient>(IServiceCollection, Action<IServiceProvider,HttpClient>)

IHttpClientFactory 和相關服務新增至 IServiceCollection,並設定 TClient 類型與具名 HttpClient 之間的繫結。 用戶端名稱將會設定為 TClient 的類型名稱。

AddHttpClient<TClient>(IServiceCollection, Action<HttpClient>)

IHttpClientFactory 和相關服務新增至 IServiceCollection,並設定 TClient 類型與具名 HttpClient 之間的繫結。 用戶端名稱將會設定為 TClient 的類型名稱。

AddHttpClient<TClient>(IServiceCollection, String)

IHttpClientFactory 和相關服務新增至 IServiceCollection,並設定 TClient 類型與具名 HttpClient 之間的繫結。

AddHttpClient<TClient>(IServiceCollection, String, Action<IServiceProvider,HttpClient>)

IHttpClientFactory 和相關服務新增至 IServiceCollection,並設定 TClient 類型與具名 HttpClient 之間的繫結。

AddHttpClient<TClient>(IServiceCollection, String, Action<HttpClient>)

IHttpClientFactory 和相關服務新增至 IServiceCollection,並設定 TClient 類型與具名 HttpClient 之間的繫結。

AddHttpClient<TClient,TImplementation>(IServiceCollection)

IHttpClientFactory 和相關服務新增至 IServiceCollection,並設定 TClient 類型與具名 HttpClient 之間的繫結。 用戶端名稱將會設定為 TClient 的類型名稱。

AddHttpClient<TClient,TImplementation>(IServiceCollection, Action<IServiceProvider,HttpClient>)

IHttpClientFactory 和相關服務新增至 IServiceCollection,並設定 TClient 類型與具名 HttpClient 之間的繫結。 用戶端名稱將會設定為 TClient 的類型名稱。

AddHttpClient<TClient,TImplementation>(IServiceCollection, Action<HttpClient>)

IHttpClientFactory 和相關服務新增至 IServiceCollection,並設定 TClient 類型與具名 HttpClient 之間的繫結。 用戶端名稱將會設定為 TClient 的類型名稱。

AddHttpClient<TClient,TImplementation>(IServiceCollection, Func<HttpClient,TImplementation>)

IHttpClientFactory 和相關服務新增至 IServiceCollection,並設定 TClient 類型與具名 HttpClient 之間的繫結。

AddHttpClient<TClient,TImplementation>(IServiceCollection, Func<HttpClient,IServiceProvider,TImplementation>)

IHttpClientFactory 和相關服務新增至 IServiceCollection,並設定 TClient 類型與具名 HttpClient 之間的繫結。

AddHttpClient<TClient,TImplementation>(IServiceCollection, String)

IHttpClientFactory 和相關服務新增至 IServiceCollection,並設定 TClient 類型與具名 HttpClient 之間的繫結。 用戶端名稱將會設定為 TClient 的類型名稱。

AddHttpClient<TClient,TImplementation>(IServiceCollection, String, Action<IServiceProvider,HttpClient>)

IHttpClientFactory 和相關服務新增至 IServiceCollection,並設定 TClient 類型與具名 HttpClient 之間的繫結。

AddHttpClient<TClient,TImplementation>(IServiceCollection, String, Action<HttpClient>)

IHttpClientFactory 和相關服務新增至 IServiceCollection,並設定 TClient 類型與具名 HttpClient 之間的繫結。

AddHttpClient<TClient,TImplementation>(IServiceCollection, String, Func<HttpClient,TImplementation>)

IHttpClientFactory 和相關服務新增至 IServiceCollection,並設定 TClient 類型與具名 HttpClient 之間的繫結。

AddHttpClient<TClient,TImplementation>(IServiceCollection, String, Func<HttpClient,IServiceProvider,TImplementation>)

IHttpClientFactory 和相關服務新增至 IServiceCollection,並設定 TClient 類型與具名 HttpClient 之間的繫結。

ConfigureHttpClientDefaults(IServiceCollection, Action<IHttpClientBuilder>)

加入將用來設定所有 HttpClient 實例的委派。

AddHttpClientLatencyTelemetry(IServiceCollection)

DelegatingHandler加入 以收集延遲資訊,並擴充所有 HTTP 用戶端的傳出要求記錄檔。

AddHttpClientLatencyTelemetry(IServiceCollection, IConfigurationSection)

DelegatingHandler加入 以收集延遲資訊,並擴充所有 HTTP 用戶端的傳出要求記錄檔。

AddHttpClientLatencyTelemetry(IServiceCollection, Action<HttpClientLatencyTelemetryOptions>)

DelegatingHandler加入 以收集延遲資訊,並擴充所有 HTTP 用戶端的傳出要求記錄檔。

AddExtendedHttpClientLogging(IServiceCollection)

針對使用 IHttpClientFactory建立的所有 HTTP 用戶端,新增 以IHttpClientAsyncLogger發出傳出要求的記錄。

AddExtendedHttpClientLogging(IServiceCollection, IConfigurationSection)

針對使用 IHttpClientFactory建立的所有 HTTP 用戶端,新增 以IHttpClientAsyncLogger發出傳出要求的記錄。

AddExtendedHttpClientLogging(IServiceCollection, Action<LoggingOptions>)

針對使用 IHttpClientFactory建立的所有 HTTP 用戶端,新增 以IHttpClientAsyncLogger發出傳出要求的記錄。

AddHttpClientLogEnricher<T>(IServiceCollection)

將的 T 擴充器實例加入至 IServiceCollection 以擴充 HttpClient 記錄。

AddDownstreamDependencyMetadata(IServiceCollection, IDownstreamDependencyMetadata)

新增相依性元數據。

AddDownstreamDependencyMetadata<T>(IServiceCollection)

新增相依性元數據。

AddKubernetesProbes(IServiceCollection)

使用預設選項註冊活躍度、啟動和整備探查。

AddKubernetesProbes(IServiceCollection, IConfigurationSection)

使用已設定的選項來註冊活躍度、啟動和整備探查。

AddKubernetesProbes(IServiceCollection, Action<KubernetesProbesOptions>)

使用已設定的選項來註冊活躍度、啟動和整備探查。

AddConsoleLatencyDataExporter(IServiceCollection)

新增主控台的延遲數據匯出工具。

AddConsoleLatencyDataExporter(IServiceCollection, IConfigurationSection)

新增主控台的延遲數據匯出工具。

AddConsoleLatencyDataExporter(IServiceCollection, Action<LatencyConsoleOptions>)

新增主控台的延遲數據匯出工具。

AddLatencyContext(IServiceCollection)

新增延遲內容。

AddLatencyContext(IServiceCollection, IConfigurationSection)

新增延遲內容。

AddLatencyContext(IServiceCollection, Action<LatencyContextOptions>)

新增延遲內容。

RegisterCheckpointNames(IServiceCollection, String[])

註冊延遲內容的一組檢查點名稱。

RegisterMeasureNames(IServiceCollection, String[])

註冊延遲內容的一組量值名稱。

RegisterTagNames(IServiceCollection, String[])

為延遲內容註冊一組標記名稱。

AddLocalization(IServiceCollection)

新增應用程式當地語系化所需的服務。

AddLocalization(IServiceCollection, Action<LocalizationOptions>)

新增應用程式當地語系化所需的服務。

AddLogging(IServiceCollection)

將記錄服務新增至指定的 IServiceCollection

AddLogging(IServiceCollection, Action<ILoggingBuilder>)

將記錄服務新增至指定的 IServiceCollection

AddDistributedMemoryCache(IServiceCollection)

新增 IDistributedCache 的預設實作,將記憶體中的項目儲存至 IServiceCollection。 需要分散式快取才能運作的架構,可以安全地將此相依性新增為其相依性清單的一部分,以確保至少有一個可用的實作。

AddDistributedMemoryCache(IServiceCollection, Action<MemoryDistributedCacheOptions>)

新增 IDistributedCache 的預設實作,將記憶體中的項目儲存至 IServiceCollection。 需要分散式快取才能運作的架構,可以安全地將此相依性新增為其相依性清單的一部分,以確保至少有一個可用的實作。

AddMemoryCache(IServiceCollection)

IMemoryCache 的非分散式記憶體內實作新增至 IServiceCollection

AddMemoryCache(IServiceCollection, Action<MemoryCacheOptions>)

IMemoryCache 的非分散式記憶體內實作新增至 IServiceCollection

AddMetrics(IServiceCollection)

將計量服務新增到指定的 IServiceCollection

AddMetrics(IServiceCollection, Action<IMetricsBuilder>)

將計量服務新增到指定的 IServiceCollection

AddNullLatencyContext(IServiceCollection)

將無作業延遲內容新增至相依性插入容器。

AddPooled<TService>(IServiceCollection, Action<DependencyInjectionPoolOptions>)

ObjectPool<T>加入 ,並讓 DI 傳回 的範圍TService實例。

AddPooled<TService,TImplementation>(IServiceCollection, Action<DependencyInjectionPoolOptions>)

ObjectPool<T>加入 ,並讓 DI 傳回 的範圍TService實例。

ConfigurePool<TService>(IServiceCollection, Action<DependencyInjectionPoolOptions>)

註冊用來設定 DependencyInjectionPoolOptions 具型別集區的 動作。

ConfigurePools(IServiceCollection, IConfigurationSection)

設定 DI 集區。

Configure<TOptions>(IServiceCollection, IConfiguration)

註冊 TOptions 將要繫結的組態執行個體,並在組態變更時更新選項。

Configure<TOptions>(IServiceCollection, IConfiguration, Action<BinderOptions>)

註冊 TOptions 將繫結的組態執行個體。

Configure<TOptions>(IServiceCollection, String, IConfiguration)

註冊 TOptions 將繫結的組態執行個體。

Configure<TOptions>(IServiceCollection, String, IConfiguration, Action<BinderOptions>)

註冊 TOptions 將繫結的組態執行個體。

AddOptions(IServiceCollection)

新增使用選項所需的服務。

AddOptions<TOptions>(IServiceCollection)

取得選項產生器,這個產生器會將 Configure 相同具名 TOptions 的呼叫轉送至基礎服務集合。

AddOptions<TOptions>(IServiceCollection, String)

取得選項產生器,這個產生器會將 Configure 相同具名 TOptions 的呼叫轉送至基礎服務集合。

AddOptionsWithValidateOnStart<TOptions>(IServiceCollection, String)

新增使用選項所需的服務,並在啟動時強制執行選項驗證檢查,而不是在運行時間強制執行。

AddOptionsWithValidateOnStart<TOptions,TValidateOptions>(IServiceCollection, String)

新增使用選項所需的服務,並在啟動時強制執行選項驗證檢查,而不是在運行時間強制執行。

Configure<TOptions>(IServiceCollection, Action<TOptions>)

註冊用來在啟動期間一次設定特定選項類型的動作。 這會在 PostConfigure<TOptions>(IServiceCollection, Action<TOptions>) 之前執行。 對設定進行更新不會再次叫用動作。

Configure<TOptions>(IServiceCollection, String, Action<TOptions>)

註冊用來設定特定選項類型的動作。 這些會在 PostConfigure<TOptions>(IServiceCollection, Action<TOptions>) 之前執行。

ConfigureAll<TOptions>(IServiceCollection, Action<TOptions>)

註冊用於設定特定選項類型的所有執行個體動作。

ConfigureOptions(IServiceCollection, Object)

註冊將擁有其 I[Post]ConfigureOptions 所有已註冊的物件。

ConfigureOptions(IServiceCollection, Type)

註冊類型,此類型會擁有其 I[Post]ConfigureOptions 所有已註冊的 。

ConfigureOptions<TConfigureOptions>(IServiceCollection)

註冊類型,此類型會擁有其 I[Post]ConfigureOptions 所有已註冊的 。

PostConfigure<TOptions>(IServiceCollection, Action<TOptions>)

註冊用於初始化特定類型選項的動作。 這些會在 Configure<TOptions>(IServiceCollection, Action<TOptions>) 之後執行。

PostConfigure<TOptions>(IServiceCollection, String, Action<TOptions>)

註冊用來設定特定選項類型的動作。 這些會在 Configure<TOptions>(IServiceCollection, Action<TOptions>) 之後執行。

PostConfigureAll<TOptions>(IServiceCollection, Action<TOptions>)

註冊用於張貼設定特定選項類型的所有執行個體動作。 這些會在 Configure<TOptions>(IServiceCollection, Action<TOptions>) 之後執行。

AddPolicyRegistry(IServiceCollection)

使用服務類型 IPolicyRegistry<TKey>IReadOnlyPolicyRegistry<TKey> 在服務集合中註冊空白 PolicyRegistry,並傳回新建立的登錄。

AddPolicyRegistry(IServiceCollection, IPolicyRegistry<String>)

使用服務類型 IPolicyRegistry<TKey>IReadOnlyPolicyRegistry<TKey> 在服務集合中註冊所提供的 IPolicyRegistry<TKey>,並傳回所提供的登錄。

AddProcessLogEnricher(IServiceCollection)

將行程擴充器的實體加入至 IServiceCollection

AddProcessLogEnricher(IServiceCollection, IConfigurationSection)

將主機擴充器的實體加入至 IServiceCollection

AddProcessLogEnricher(IServiceCollection, Action<ProcessLogEnricherOptions>)

將行程擴充器的實體加入至 IServiceCollection

AddRedaction(IServiceCollection)

在中註冊的實作IRedactorProviderIServiceCollection

AddRedaction(IServiceCollection, Action<IRedactionBuilder>)

在 中IServiceCollection註冊 的實作IRedactorProvider,並設定可用的重新執行者。

AddDistributedRedisCache(IServiceCollection, Action<RedisCacheOptions>)

將 Redis 分散式快取服務新增至指定的 IServiceCollection

AddResilienceEnricher(IServiceCollection)

新增復原擴充器。

AddResourceMonitoring(IServiceCollection)

設定並新增 IResourceMonitor 實作至服務集合。

AddResourceMonitoring(IServiceCollection, Action<IResourceMonitorBuilder>)

設定並新增 IResourceMonitor 實作至服務集合。

BuildServiceProvider(IServiceCollection)

從所提供 IServiceCollection 建立包含服務的 ServiceProvider

BuildServiceProvider(IServiceCollection, ServiceProviderOptions)

從所提供 IServiceCollection 建立包含服務的 ServiceProvider,選擇性地啟用服務建立和範圍驗證。

BuildServiceProvider(IServiceCollection, Boolean)

從所提供 IServiceCollection 建立包含服務的 ServiceProvider,選擇性地啟用範圍驗證。

AddHostedService<THostedService>(IServiceCollection)

為指定的類型新增 IHostedService 註冊。

AddHostedService<THostedService>(IServiceCollection, Func<IServiceProvider,THostedService>)

為指定的類型新增 IHostedService 註冊。

AddKeyedScoped(IServiceCollection, Type, Object)

serviceType 中指定類型的範圍服務,新增至指定的 IServiceCollection

AddKeyedScoped(IServiceCollection, Type, Object, Func<IServiceProvider,Object,Object>)

serviceType 中指定類型的範圍服務,以及 implementationFactory 中指定的 Factory,新增至指定的 IServiceCollection

AddKeyedScoped(IServiceCollection, Type, Object, Type)

serviceType 中指定類型的範圍服務,以及在 implementationType 中指定類型的實作,新增至指定的 IServiceCollection

AddKeyedScoped<TService>(IServiceCollection, Object)

TService 中指定類型的範圍服務,新增至指定的 IServiceCollection

AddKeyedScoped<TService>(IServiceCollection, Object, Func<IServiceProvider,Object,TService>)

TService 中指定類型的範圍服務,以及 implementationFactory 中指定的 Factory,新增至指定的 IServiceCollection

AddKeyedScoped<TService,TImplementation>(IServiceCollection, Object)

TService 中指定類型的範圍服務,以及在 TImplementation 中指定的實作類型,新增至指定的 IServiceCollection

AddKeyedScoped<TService,TImplementation>(IServiceCollection, Object, Func<IServiceProvider,Object,TImplementation>)

使用 implementationFactory 中指定的 Factory,將 TService 中指定類型的範圍服務,以及 TImplementation 中指定的實作類型,新增至指定的 IServiceCollection

AddKeyedSingleton(IServiceCollection, Type, Object)

serviceType 中指定類型的單一服務,新增至指定的 IServiceCollection

AddKeyedSingleton(IServiceCollection, Type, Object, Func<IServiceProvider,Object,Object>)

serviceType 中指定類型的單一服務,以及 implementationFactory 中指定的 Factory,新增至指定的 IServiceCollection

AddKeyedSingleton(IServiceCollection, Type, Object, Object)

serviceType 中指定類型的單一服務,以及 implementationInstance 中指定的執行個體,新增至指定的 IServiceCollection

AddKeyedSingleton(IServiceCollection, Type, Object, Type)

serviceType 中指定類型的單一服務,以及在 implementationType 中指定類型的實作,新增至指定的 IServiceCollection

AddKeyedSingleton<TService>(IServiceCollection, Object)

TService 中指定類型的單一服務,新增至指定的 IServiceCollection

AddKeyedSingleton<TService>(IServiceCollection, Object, TService)

TService 中指定類型的單一服務,以及 implementationInstance 中指定的執行個體,新增至指定的 IServiceCollection

AddKeyedSingleton<TService>(IServiceCollection, Object, Func<IServiceProvider,Object,TService>)

TService 中指定類型的單一服務,以及 implementationFactory 中指定的 Factory,新增至指定的 IServiceCollection

AddKeyedSingleton<TService,TImplementation>(IServiceCollection, Object)

TService 中指定類型的單一服務,以及在 TImplementation 中指定的實作類型,新增至指定的 IServiceCollection

AddKeyedSingleton<TService,TImplementation>(IServiceCollection, Object, Func<IServiceProvider,Object,TImplementation>)

使用 implementationFactory 中指定的 Factory,將 TService 中指定類型的單一服務,以及 TImplementation 中指定的實作類型,新增至指定的 IServiceCollection

AddKeyedTransient(IServiceCollection, Type, Object)

serviceType 中指定類型的暫時性服務,新增至指定的 IServiceCollection

AddKeyedTransient(IServiceCollection, Type, Object, Func<IServiceProvider,Object,Object>)

serviceType 中指定類型的暫時性服務,以及 implementationFactory 中指定的 Factory,新增至指定的 IServiceCollection

AddKeyedTransient(IServiceCollection, Type, Object, Type)

serviceType 中指定類型的暫時性服務,以及在 implementationType 中指定類型的實作,新增至指定的 IServiceCollection

AddKeyedTransient<TService>(IServiceCollection, Object)

TService 中指定類型的暫時性服務,新增至指定的 IServiceCollection

AddKeyedTransient<TService>(IServiceCollection, Object, Func<IServiceProvider,Object,TService>)

TService 中指定類型的暫時性服務,以及 implementationFactory 中指定的 Factory,新增至指定的 IServiceCollection

AddKeyedTransient<TService,TImplementation>(IServiceCollection, Object)

TService 中指定類型的暫時性服務,以及在 TImplementation 中指定的實作類型,新增至指定的 IServiceCollection

AddKeyedTransient<TService,TImplementation>(IServiceCollection, Object, Func<IServiceProvider,Object,TImplementation>)

使用 implementationFactory 中指定的 Factory,將 TService 中指定類型的暫時性服務,以及 TImplementation 中指定的實作類型,新增至指定的 IServiceCollection

AddScoped(IServiceCollection, Type)

serviceType 中指定類型的範圍服務,新增至指定的 IServiceCollection

AddScoped(IServiceCollection, Type, Func<IServiceProvider,Object>)

serviceType 中指定類型的範圍服務,以及 implementationFactory 中指定的 Factory,新增至指定的 IServiceCollection

AddScoped(IServiceCollection, Type, Type)

serviceType 中指定類型的範圍服務,以及在 implementationType 中指定類型的實作,新增至指定的 IServiceCollection

AddScoped<TService>(IServiceCollection)

TService 中指定類型的範圍服務,新增至指定的 IServiceCollection

AddScoped<TService>(IServiceCollection, Func<IServiceProvider,TService>)

TService 中指定類型的範圍服務,以及 implementationFactory 中指定的 Factory,新增至指定的 IServiceCollection

AddScoped<TService,TImplementation>(IServiceCollection)

TService 中指定類型的範圍服務,以及在 TImplementation 中指定的實作類型,新增至指定的 IServiceCollection

AddScoped<TService,TImplementation>(IServiceCollection, Func<IServiceProvider,TImplementation>)

使用 implementationFactory 中指定的 Factory,將 TService 中指定類型的範圍服務,以及 TImplementation 中指定的實作類型,新增至指定的 IServiceCollection

AddSingleton(IServiceCollection, Type)

serviceType 中指定類型的單一服務,新增至指定的 IServiceCollection

AddSingleton(IServiceCollection, Type, Func<IServiceProvider,Object>)

serviceType 中指定類型的單一服務,以及 implementationFactory 中指定的 Factory,新增至指定的 IServiceCollection

AddSingleton(IServiceCollection, Type, Object)

serviceType 中指定類型的單一服務,以及 implementationInstance 中指定的執行個體,新增至指定的 IServiceCollection

AddSingleton(IServiceCollection, Type, Type)

serviceType 中指定類型的單一服務,以及在 implementationType 中指定類型的實作,新增至指定的 IServiceCollection

AddSingleton<TService>(IServiceCollection)

TService 中指定類型的單一服務,新增至指定的 IServiceCollection

AddSingleton<TService>(IServiceCollection, TService)

TService 中指定類型的單一服務,以及 implementationInstance 中指定的執行個體,新增至指定的 IServiceCollection

AddSingleton<TService>(IServiceCollection, Func<IServiceProvider,TService>)

TService 中指定類型的單一服務,以及 implementationFactory 中指定的 Factory,新增至指定的 IServiceCollection

AddSingleton<TService,TImplementation>(IServiceCollection)

TService 中指定類型的單一服務,以及在 TImplementation 中指定的實作類型,新增至指定的 IServiceCollection

AddSingleton<TService,TImplementation>(IServiceCollection, Func<IServiceProvider,TImplementation>)

使用 implementationFactory 中指定的 Factory,將 TService 中指定類型的單一服務,以及 TImplementation 中指定的實作類型,新增至指定的 IServiceCollection

AddTransient(IServiceCollection, Type)

serviceType 中指定類型的暫時性服務,新增至指定的 IServiceCollection

AddTransient(IServiceCollection, Type, Func<IServiceProvider,Object>)

serviceType 中指定類型的暫時性服務,以及 implementationFactory 中指定的 Factory,新增至指定的 IServiceCollection

AddTransient(IServiceCollection, Type, Type)

serviceType 中指定類型的暫時性服務,以及在 implementationType 中指定類型的實作,新增至指定的 IServiceCollection

AddTransient<TService>(IServiceCollection)

TService 中指定類型的暫時性服務,新增至指定的 IServiceCollection

AddTransient<TService>(IServiceCollection, Func<IServiceProvider,TService>)

TService 中指定類型的暫時性服務,以及 implementationFactory 中指定的 Factory,新增至指定的 IServiceCollection

AddTransient<TService,TImplementation>(IServiceCollection)

TService 中指定類型的暫時性服務,以及在 TImplementation 中指定的實作類型,新增至指定的 IServiceCollection

AddTransient<TService,TImplementation>(IServiceCollection, Func<IServiceProvider,TImplementation>)

使用 implementationFactory 中指定的 Factory,將 TService 中指定類型的暫時性服務,以及 TImplementation 中指定的實作類型,新增至指定的 IServiceCollection

AddDistributedSqlServerCache(IServiceCollection, Action<SqlServerCacheOptions>)

將 Microsoft SQL Server 分散式快取服務新增至指定的 IServiceCollection

AddStackExchangeRedisCache(IServiceCollection, Action<RedisCacheOptions>)

將 Redis 分散式快取服務新增至指定的 IServiceCollection

AddTcpEndpointProbe(IServiceCollection)

如果服務被視為狀況良好,則使用 TCP 通訊埠註冊健康 IHealthCheck情況狀態報告。

AddTcpEndpointProbe(IServiceCollection, IConfigurationSection)

如果服務被視為狀況良好,則使用 TCP 通訊埠註冊健康 IHealthCheck情況狀態報告。

AddTcpEndpointProbe(IServiceCollection, Action<TcpEndpointProbesOptions>)

如果服務被視為狀況良好,則使用 TCP 通訊埠註冊健康 IHealthCheck情況狀態報告。

AddTcpEndpointProbe(IServiceCollection, String)

如果服務被視為狀況良好,則使用 TCP 通訊埠註冊健康 IHealthCheck情況狀態報告。

AddTcpEndpointProbe(IServiceCollection, String, IConfigurationSection)

如果服務被視為狀況良好,則使用 TCP 通訊埠註冊健康 IHealthCheck情況狀態報告。

AddTcpEndpointProbe(IServiceCollection, String, Action<TcpEndpointProbesOptions>)

如果服務被視為狀況良好,則使用 TCP 通訊埠註冊健康 IHealthCheck情況狀態報告。

AddSystemd(IServiceCollection)

指定服務描述項集合的合約。

AddWindowsService(IServiceCollection)

指定服務描述項集合的合約。

AddWindowsService(IServiceCollection, Action<WindowsServiceLifetimeOptions>)

指定服務描述項集合的合約。

AsReadOnly<T>(IList<T>)

傳回指定清單的唯讀 ReadOnlyCollection<T> 包裝函式。

CopyToDataTable<T>(IEnumerable<T>)

根據輸入 DataTable 物件 (其中泛型參數 TDataRow) 傳回包含 IEnumerable<T> 物件複本的 DataRow

CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption)

根據輸入 DataRow 物件 (其中泛型參數 TDataTable),將 IEnumerable<T> 物件複製到指定的 DataRow

CopyToDataTable<T>(IEnumerable<T>, DataTable, LoadOption, FillErrorEventHandler)

根據輸入 DataRow 物件 (其中泛型參數 TDataTable),將 IEnumerable<T> 物件複製到指定的 DataRow

適用於