OptionsServiceCollectionExtensions.Configure 方法

定義

多載

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

註冊用來在啟動期間一次設定特定選項類型的動作。Registers an action used to configure a particular type of options once during startup. 這會在 PostConfigure<TOptions>(IServiceCollection, Action<TOptions>) 之前執行。This is run before PostConfigure<TOptions>(IServiceCollection, Action<TOptions>). 對設定進行更新不會再次叫用動作。Updates to the configuration does not invoke the action again.

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

註冊用來設定特定選項類型的動作。Registers an action used to configure a particular type of options. 這些會在 PostConfigure<TOptions>(IServiceCollection, Action<TOptions>) 之前執行。These are run before PostConfigure<TOptions>(IServiceCollection, Action<TOptions>).

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

註冊用來在啟動期間一次設定特定選項類型的動作。Registers an action used to configure a particular type of options once during startup. 這會在 PostConfigure<TOptions>(IServiceCollection, Action<TOptions>) 之前執行。This is run before PostConfigure<TOptions>(IServiceCollection, Action<TOptions>). 對設定進行更新不會再次叫用動作。Updates to the configuration does not invoke the action again.

public:
generic <typename TOptions>
 where TOptions : class[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IServiceCollection ^ Configure(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, Action<TOptions> ^ configureOptions);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection Configure<TOptions> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Action<TOptions> configureOptions) where TOptions : class;
static member Configure : Microsoft.Extensions.DependencyInjection.IServiceCollection * Action<'Options (requires 'Options : null)> -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'Options : null)
<Extension()>
Public Function Configure(Of TOptions As Class) (services As IServiceCollection, configureOptions As Action(Of TOptions)) As IServiceCollection

類型參數

TOptions

要設定的選項類型。The options type to be configured.

參數

services
IServiceCollection

要新增服務的 IServiceCollectionThe IServiceCollection to add the services to.

configureOptions
Action<TOptions>

用來設定選項的動作。The action used to configure the options.

傳回

IServiceCollection

IServiceCollection,以便鏈結其他呼叫。The IServiceCollection so that additional calls can be chained.

適用於

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

註冊用來設定特定選項類型的動作。Registers an action used to configure a particular type of options. 這些會在 PostConfigure<TOptions>(IServiceCollection, Action<TOptions>) 之前執行。These are run before PostConfigure<TOptions>(IServiceCollection, Action<TOptions>).

public:
generic <typename TOptions>
 where TOptions : class[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IServiceCollection ^ Configure(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, System::String ^ name, Action<TOptions> ^ configureOptions);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection Configure<TOptions> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, string name, Action<TOptions> configureOptions) where TOptions : class;
static member Configure : Microsoft.Extensions.DependencyInjection.IServiceCollection * string * Action<'Options (requires 'Options : null)> -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'Options : null)
<Extension()>
Public Function Configure(Of TOptions As Class) (services As IServiceCollection, name As String, configureOptions As Action(Of TOptions)) As IServiceCollection

類型參數

TOptions

要設定的選項類型。The options type to be configured.

參數

services
IServiceCollection

要新增服務的 IServiceCollectionThe IServiceCollection to add the services to.

name
String

選項執行個體的名稱。The name of the options instance.

configureOptions
Action<TOptions>

用來設定選項的動作。The action used to configure the options.

傳回

IServiceCollection

IServiceCollection,以便鏈結其他呼叫。The IServiceCollection so that additional calls can be chained.

適用於