OptionsServiceCollectionExtensions.AddOptionsWithValidateOnStart Method
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.
Overloads
AddOptionsWithValidateOnStart<TOptions,TValidateOptions>(IServiceCollection, String) |
Adds services required for using options and enforces options validation check on start rather than in runtime. |
AddOptionsWithValidateOnStart<TOptions>(IServiceCollection, String) |
Adds services required for using options and enforces options validation check on start rather than in runtime. |
AddOptionsWithValidateOnStart<TOptions,TValidateOptions>(IServiceCollection, String)
Adds services required for using options and enforces options validation check on start rather than in runtime.
public static Microsoft.Extensions.Options.OptionsBuilder<TOptions> AddOptionsWithValidateOnStart<TOptions,TValidateOptions> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, string? name = default) where TOptions : class where TValidateOptions : class, Microsoft.Extensions.Options.IValidateOptions<TOptions>;
static member AddOptionsWithValidateOnStart : Microsoft.Extensions.DependencyInjection.IServiceCollection * string -> Microsoft.Extensions.Options.OptionsBuilder<'Options (requires 'Options : null)> (requires 'Options : null and 'ValidateOptions : null and 'ValidateOptions :> Microsoft.Extensions.Options.IValidateOptions<'Options>)
<Extension()>
Public Function AddOptionsWithValidateOnStart(Of TOptions As Class, TValidateOptions As Class) (services As IServiceCollection, Optional name As String = Nothing) As OptionsBuilder(Of TOptions)
Type Parameters
- TOptions
The options type to be configured.
- TValidateOptions
The IValidateOptions<TOptions> validator type.
Parameters
- services
- IServiceCollection
The IServiceCollection to add the services to.
- name
- String
The name of the options instance.
Returns
The OptionsBuilder<TOptions> so that configure calls can be chained in it.
Remarks
The ValidateOnStart<TOptions>(OptionsBuilder<TOptions>) extension is called by this method.
Applies to
AddOptionsWithValidateOnStart<TOptions>(IServiceCollection, String)
Adds services required for using options and enforces options validation check on start rather than in runtime.
public static Microsoft.Extensions.Options.OptionsBuilder<TOptions> AddOptionsWithValidateOnStart<TOptions> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, string? name = default) where TOptions : class;
static member AddOptionsWithValidateOnStart : Microsoft.Extensions.DependencyInjection.IServiceCollection * string -> Microsoft.Extensions.Options.OptionsBuilder<'Options (requires 'Options : null)> (requires 'Options : null)
<Extension()>
Public Function AddOptionsWithValidateOnStart(Of TOptions As Class) (services As IServiceCollection, Optional name As String = Nothing) As OptionsBuilder(Of TOptions)
Type Parameters
- TOptions
The options type to be configured.
Parameters
- services
- IServiceCollection
The IServiceCollection to add the services to.
- name
- String
The name of the options instance.
Returns
The OptionsBuilder<TOptions> so that configure calls can be chained in it.
Remarks
The ValidateOnStart<TOptions>(OptionsBuilder<TOptions>) extension is called by this method.