OptionsServiceCollectionExtensions 类

定义

用于向 DI 容器添加选项服务的扩展方法。Extension methods for adding options services to the DI container.

public ref class OptionsServiceCollectionExtensions abstract sealed
public static class OptionsServiceCollectionExtensions
type OptionsServiceCollectionExtensions = class
Public Module OptionsServiceCollectionExtensions
继承
OptionsServiceCollectionExtensions

方法

AddOptions(IServiceCollection)

添加使用选项所需的服务。Adds services required for using options.

AddOptions<TOptions>(IServiceCollection)

获取一个选项生成器,以便将同一命名 TOptions配置调用转发到基础服务集合。Gets an options builder that forwards Configure calls for the same named TOptions to the underlying service collection.

AddOptions<TOptions>(IServiceCollection, String)

获取一个选项生成器,以便将同一命名 TOptions配置调用转发到基础服务集合。Gets an options builder that forwards Configure calls for the same named TOptions to the underlying service collection.

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>).

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

注册用于配置特定类型的选项的所有实例的操作。Registers an action used to configure all instances of a particular type of options.

ConfigureOptions(IServiceCollection, Object)

注册将注册其所有 I[Post]ConfigureOptions 的对象。Registers an object that will have all of its I[Post]ConfigureOptions registered.

ConfigureOptions(IServiceCollection, Type)

注册将注册其所有 I[Post]ConfigureOptions 的类型。Registers a type that will have all of its I[Post]ConfigureOptions registered.

ConfigureOptions<TConfigureOptions>(IServiceCollection)

注册将注册其所有 I[Post]ConfigureOptions 的类型。Registers a type that will have all of its I[Post]ConfigureOptions registered.

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

注册用于初始化特定类型的选项的操作。Registers an action used to initialize a particular type of options. 这些都在 Configure<TOptions>(IServiceCollection, Action<TOptions>) 之后运行。These are run after Configure<TOptions>(IServiceCollection, Action<TOptions>).

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

注册用于配置特定类型的选项的操作。Registers an action used to configure a particular type of options. 这些都在 Configure<TOptions>(IServiceCollection, Action<TOptions>) 之后运行。These are run after Configure<TOptions>(IServiceCollection, Action<TOptions>).

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

注册用于对特定类型的选项的所有实例进行后期配置的操作。Registers an action used to post configure all instances of a particular type of options. 这些都在 Configure<TOptions>(IServiceCollection, Action<TOptions>) 之后运行。These are run after Configure<TOptions>(IServiceCollection, Action<TOptions>).

适用于