OptionsBuilderConfigurationExtensions.BindConfiguration<TOptions> 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.
Registers the dependency injection container to bind TOptions
against the IConfiguration obtained from the DI service provider.
public static Microsoft.Extensions.Options.OptionsBuilder<TOptions> BindConfiguration<TOptions> (this Microsoft.Extensions.Options.OptionsBuilder<TOptions> optionsBuilder, string configSectionPath, Action<Microsoft.Extensions.Configuration.BinderOptions>? configureBinder = default) where TOptions : class;
static member BindConfiguration : Microsoft.Extensions.Options.OptionsBuilder<'Options (requires 'Options : null)> * string * Action<Microsoft.Extensions.Configuration.BinderOptions> -> Microsoft.Extensions.Options.OptionsBuilder<'Options (requires 'Options : null)> (requires 'Options : null)
<Extension()>
Public Function BindConfiguration(Of TOptions As Class) (optionsBuilder As OptionsBuilder(Of TOptions), configSectionPath As String, Optional configureBinder As Action(Of BinderOptions) = Nothing) As OptionsBuilder(Of TOptions)
Type Parameters
- TOptions
The options type to be configured.
Parameters
- optionsBuilder
- OptionsBuilder<TOptions>
The options builder to add the services to.
- configSectionPath
- String
The name of the configuration section to bind from.
- configureBinder
- Action<BinderOptions>
Optional. Used to configure the BinderOptions.
Returns
The OptionsBuilder<TOptions> so that additional calls can be chained.
Exceptions
optionsBuilder
or configSectionPath
is null
.
Applies to
משוב
https://aka.ms/ContentUserFeedback.
בקרוב: במהלך 2024, נפתור בעיות GitHub כמנגנון המשוב לתוכן ונחליף אותו במערכת משוב חדשה. לקבלת מידע נוסף, ראה:שלח והצג משוב עבור