Op Englesch liesen

Deelen iwwer


OptionsServiceCollectionExtensions Class

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Extension methods for adding options services to the DI container.

C#
public static class OptionsServiceCollectionExtensions
Inheritance
OptionsServiceCollectionExtensions

Methods

AddOptions(IServiceCollection)

Adds services required for using options.

AddOptions<TOptions>(IServiceCollection, String)

Gets an options builder that forwards Configure calls for the same named TOptions to the underlying service collection.

AddOptions<TOptions>(IServiceCollection)

Gets an options builder that forwards Configure calls for the same TOptions to the underlying service collection.

AddOptionsWithValidateOnStart<TOptions,TValidateOptions>(IServiceCollection, String)

Adds services required for using options and enforces options validation check on start rather than at run time.

AddOptionsWithValidateOnStart<TOptions>(IServiceCollection, String)

Adds services required for using options and enforces options validation check on start rather than at run time.

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

Registers an action used to configure a particular type of options. Note: These are run before all PostConfigure<TOptions>(IServiceCollection, Action<TOptions>).

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

Registers an action used to configure a particular type of options. Note: These are run before all 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)

Registers an object that will have all of its IConfigureOptions<TOptions>, IPostConfigureOptions<TOptions>, and IValidateOptions<TOptions> registered.

ConfigureOptions(IServiceCollection, Type)

Registers a type that will have all of its IConfigureOptions<TOptions>, IPostConfigureOptions<TOptions>, and IValidateOptions<TOptions> registered.

ConfigureOptions<TConfigureOptions>(IServiceCollection)

Registers a type that will have all of its IConfigureOptions<TOptions>, IPostConfigureOptions<TOptions>, and IValidateOptions<TOptions> registered.

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

Registers an action used to initialize a particular type of options. Note: These are run after all Configure<TOptions>(IServiceCollection, Action<TOptions>).

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

Registers an action used to configure a particular type of options. Note: These are run after all 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. Note: These are run after all Configure<TOptions>(IServiceCollection, Action<TOptions>).

Applies to

Produkt Versiounen
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Standard 2.0 (package-provided), 2.1 (package-provided)