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.

适用于