OptionsConfigurationServiceCollectionExtensions.Configure 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
Configure<TOptions>(IServiceCollection, IConfiguration) |
注册 |
Configure<TOptions>(IServiceCollection, IConfiguration, Action<BinderOptions>) |
注册将对其绑定 TOptions 的配置实例。 |
Configure<TOptions>(IServiceCollection, String, IConfiguration) |
注册将对其绑定 TOptions 的配置实例。 |
Configure<TOptions>(IServiceCollection, String, IConfiguration, Action<BinderOptions>) |
注册将对其绑定 TOptions 的配置实例。 |
Configure<TOptions>(IServiceCollection, IConfiguration)
注册 TOptions
将绑定的配置实例,并在配置更改时更新选项。
public:
generic <typename TOptions>
where TOptions : class[System::Runtime::CompilerServices::Extension]
static Microsoft::Extensions::DependencyInjection::IServiceCollection ^ Configure(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, Microsoft::Extensions::Configuration::IConfiguration ^ config);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection Configure<TOptions> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Microsoft.Extensions.Configuration.IConfiguration config) where TOptions : class;
static member Configure : Microsoft.Extensions.DependencyInjection.IServiceCollection * Microsoft.Extensions.Configuration.IConfiguration -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'Options : null)
<Extension()>
Public Function Configure(Of TOptions As Class) (services As IServiceCollection, config As IConfiguration) As IServiceCollection
类型参数
- TOptions
要配置的选项的类型。
参数
- services
- IServiceCollection
要向其中添加服务的 IServiceCollection。
- config
- IConfiguration
要绑定的配置。
返回
IServiceCollection,以便可以链接其他调用。
适用于
Configure<TOptions>(IServiceCollection, IConfiguration, Action<BinderOptions>)
注册将对其绑定 TOptions 的配置实例。
public:
generic <typename TOptions>
where TOptions : class[System::Runtime::CompilerServices::Extension]
static Microsoft::Extensions::DependencyInjection::IServiceCollection ^ Configure(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, Microsoft::Extensions::Configuration::IConfiguration ^ config, Action<Microsoft::Extensions::Configuration::BinderOptions ^> ^ configureBinder);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection Configure<TOptions> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Microsoft.Extensions.Configuration.IConfiguration config, Action<Microsoft.Extensions.Configuration.BinderOptions>? configureBinder) where TOptions : class;
static member Configure : Microsoft.Extensions.DependencyInjection.IServiceCollection * Microsoft.Extensions.Configuration.IConfiguration * Action<Microsoft.Extensions.Configuration.BinderOptions> -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'Options : null)
<Extension()>
Public Function Configure(Of TOptions As Class) (services As IServiceCollection, config As IConfiguration, configureBinder As Action(Of BinderOptions)) As IServiceCollection
类型参数
- TOptions
要配置的选项的类型。
参数
- services
- IServiceCollection
要向其中添加服务的 IServiceCollection。
- config
- IConfiguration
要绑定的配置。
- configureBinder
- Action<BinderOptions>
用于配置 BinderOptions。
返回
IServiceCollection,以便可以链接其他调用。
适用于
Configure<TOptions>(IServiceCollection, String, IConfiguration)
注册将对其绑定 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, Microsoft::Extensions::Configuration::IConfiguration ^ config);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection Configure<TOptions> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, string? name, Microsoft.Extensions.Configuration.IConfiguration config) where TOptions : class;
static member Configure : Microsoft.Extensions.DependencyInjection.IServiceCollection * string * Microsoft.Extensions.Configuration.IConfiguration -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'Options : null)
<Extension()>
Public Function Configure(Of TOptions As Class) (services As IServiceCollection, name As String, config As IConfiguration) As IServiceCollection
类型参数
- TOptions
要配置的选项的类型。
参数
- services
- IServiceCollection
要向其中添加服务的 IServiceCollection。
- name
- String
选项实例的名称。
- config
- IConfiguration
要绑定的配置。
返回
IServiceCollection,以便可以链接其他调用。
适用于
Configure<TOptions>(IServiceCollection, String, IConfiguration, Action<BinderOptions>)
注册将对其绑定 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, Microsoft::Extensions::Configuration::IConfiguration ^ config, Action<Microsoft::Extensions::Configuration::BinderOptions ^> ^ configureBinder);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection Configure<TOptions> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, string? name, Microsoft.Extensions.Configuration.IConfiguration config, Action<Microsoft.Extensions.Configuration.BinderOptions>? configureBinder) where TOptions : class;
static member Configure : Microsoft.Extensions.DependencyInjection.IServiceCollection * string * Microsoft.Extensions.Configuration.IConfiguration * Action<Microsoft.Extensions.Configuration.BinderOptions> -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'Options : null)
<Extension()>
Public Function Configure(Of TOptions As Class) (services As IServiceCollection, name As String, config As IConfiguration, configureBinder As Action(Of BinderOptions)) As IServiceCollection
类型参数
- TOptions
要配置的选项的类型。
参数
- services
- IServiceCollection
要向其中添加服务的 IServiceCollection。
- name
- String
选项实例的名称。
- config
- IConfiguration
要绑定的配置。
- configureBinder
- Action<BinderOptions>
用于配置 BinderOptions。
返回
IServiceCollection,以便可以链接其他调用。