OptionsServiceCollectionExtensions.AddOptions 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
AddOptions(IServiceCollection) |
添加使用选项所需的服务。 |
AddOptions<TOptions>(IServiceCollection) |
获取一个选项生成器,该生成器将同一命名 |
AddOptions<TOptions>(IServiceCollection, String) |
获取一个选项生成器,该生成器将同一命名 |
AddOptions(IServiceCollection)
添加使用选项所需的服务。
public:
[System::Runtime::CompilerServices::Extension]
static Microsoft::Extensions::DependencyInjection::IServiceCollection ^ AddOptions(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddOptions (this Microsoft.Extensions.DependencyInjection.IServiceCollection services);
static member AddOptions : Microsoft.Extensions.DependencyInjection.IServiceCollection -> Microsoft.Extensions.DependencyInjection.IServiceCollection
<Extension()>
Public Function AddOptions (services As IServiceCollection) As IServiceCollection
参数
- services
- IServiceCollection
要向其中添加服务的 IServiceCollection。
返回
IServiceCollection,以便可以链接其他调用。
适用于
AddOptions<TOptions>(IServiceCollection)
获取一个选项生成器,该生成器将同一命名TOptions
的 调用转发Configure
到基础服务集合。
public:
generic <typename TOptions>
where TOptions : class[System::Runtime::CompilerServices::Extension]
static Microsoft::Extensions::Options::OptionsBuilder<TOptions> ^ AddOptions(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services);
public static Microsoft.Extensions.Options.OptionsBuilder<TOptions> AddOptions<TOptions> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services) where TOptions : class;
static member AddOptions : Microsoft.Extensions.DependencyInjection.IServiceCollection -> Microsoft.Extensions.Options.OptionsBuilder<'Options (requires 'Options : null)> (requires 'Options : null)
<Extension()>
Public Function AddOptions(Of TOptions As Class) (services As IServiceCollection) As OptionsBuilder(Of TOptions)
类型参数
- TOptions
要配置的选项类型。
参数
- services
- IServiceCollection
要向其中添加服务的 IServiceCollection。
返回
OptionsBuilder<TOptions>,以便可以在其中链接配置调用。
适用于
AddOptions<TOptions>(IServiceCollection, String)
获取一个选项生成器,该生成器将同一命名TOptions
的 调用转发Configure
到基础服务集合。
public:
generic <typename TOptions>
where TOptions : class[System::Runtime::CompilerServices::Extension]
static Microsoft::Extensions::Options::OptionsBuilder<TOptions> ^ AddOptions(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, System::String ^ name);
public static Microsoft.Extensions.Options.OptionsBuilder<TOptions> AddOptions<TOptions> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, string? name) where TOptions : class;
static member AddOptions : Microsoft.Extensions.DependencyInjection.IServiceCollection * string -> Microsoft.Extensions.Options.OptionsBuilder<'Options (requires 'Options : null)> (requires 'Options : null)
<Extension()>
Public Function AddOptions(Of TOptions As Class) (services As IServiceCollection, name As String) As OptionsBuilder(Of TOptions)
类型参数
- TOptions
要配置的选项类型。
参数
- services
- IServiceCollection
要向其中添加服务的 IServiceCollection。
- name
- String
选项实例的名称。
返回
以便OptionsBuilder<TOptions>Configure
可以链接其中调用的 。