OptionsConfigurationServiceCollectionExtensions.Configure 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
Configure<TOptions>(IServiceCollection, IConfiguration) |
Registers a configuration instance that |
Configure<TOptions>(IServiceCollection, IConfiguration, Action<BinderOptions>) |
Registers a configuration instance that |
Configure<TOptions>(IServiceCollection, String, IConfiguration) |
Registers a configuration instance that |
Configure<TOptions>(IServiceCollection, String, IConfiguration, Action<BinderOptions>) |
Registers a configuration instance that |
Configure<TOptions>(IServiceCollection, IConfiguration)
Registers a configuration instance that TOptions
will bind against.
public:
generic <typename TOptions>
where TOptions : class[System::Runtime::CompilerServices::Extension]
static Microsoft::Extensions::DependencyInjection::IServiceCollection ^ Configure(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, Microsoft::Extensions::Configuration::IConfiguration ^ config);
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Binding strongly typed objects to configuration values may require generating dynamic code at runtime.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("TOptions's dependent types may have their members trimmed. Ensure all required members are preserved.")]
public static Microsoft.Extensions.DependencyInjection.IServiceCollection Configure<TOptions>(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Microsoft.Extensions.Configuration.IConfiguration config) where TOptions : class;
public static Microsoft.Extensions.DependencyInjection.IServiceCollection Configure<TOptions>(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Microsoft.Extensions.Configuration.IConfiguration config) where TOptions : class;
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Binding strongly typed objects to configuration values may require generating dynamic code at runtime.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("TOptions's dependent types may have their members trimmed. Ensure all required members are preserved.")>]
static member Configure : Microsoft.Extensions.DependencyInjection.IServiceCollection * Microsoft.Extensions.Configuration.IConfiguration -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'Options : null)
static member Configure : Microsoft.Extensions.DependencyInjection.IServiceCollection * Microsoft.Extensions.Configuration.IConfiguration -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'Options : null)
<Extension()>
Public Function Configure(Of TOptions As Class) (services As IServiceCollection, config As IConfiguration) As IServiceCollection
Type Parameters
- TOptions
The type of options being configured.
Parameters
- services
- IServiceCollection
The IServiceCollection to add the services to.
- config
- IConfiguration
The configuration being bound.
Returns
The IServiceCollection so that additional calls can be chained.
- Attributes
Applies to
Configure<TOptions>(IServiceCollection, IConfiguration, Action<BinderOptions>)
Registers a configuration instance that TOptions
will bind against.
public:
generic <typename TOptions>
where TOptions : class[System::Runtime::CompilerServices::Extension]
static Microsoft::Extensions::DependencyInjection::IServiceCollection ^ Configure(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, Microsoft::Extensions::Configuration::IConfiguration ^ config, Action<Microsoft::Extensions::Configuration::BinderOptions ^> ^ configureBinder);
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Binding strongly typed objects to configuration values may require generating dynamic code at runtime.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("TOptions's dependent types may have their members trimmed. Ensure all required members are preserved.")]
public static Microsoft.Extensions.DependencyInjection.IServiceCollection Configure<TOptions>(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Microsoft.Extensions.Configuration.IConfiguration config, Action<Microsoft.Extensions.Configuration.BinderOptions>? configureBinder) where TOptions : class;
public static Microsoft.Extensions.DependencyInjection.IServiceCollection Configure<TOptions>(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Microsoft.Extensions.Configuration.IConfiguration config, Action<Microsoft.Extensions.Configuration.BinderOptions>? configureBinder) where TOptions : class;
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Binding strongly typed objects to configuration values may require generating dynamic code at runtime.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("TOptions's dependent types may have their members trimmed. Ensure all required members are preserved.")>]
static member Configure : Microsoft.Extensions.DependencyInjection.IServiceCollection * Microsoft.Extensions.Configuration.IConfiguration * Action<Microsoft.Extensions.Configuration.BinderOptions> -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'Options : null)
static member Configure : Microsoft.Extensions.DependencyInjection.IServiceCollection * Microsoft.Extensions.Configuration.IConfiguration * Action<Microsoft.Extensions.Configuration.BinderOptions> -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'Options : null)
<Extension()>
Public Function Configure(Of TOptions As Class) (services As IServiceCollection, config As IConfiguration, configureBinder As Action(Of BinderOptions)) As IServiceCollection
Type Parameters
- TOptions
The type of options being configured.
Parameters
- services
- IServiceCollection
The IServiceCollection to add the services to.
- config
- IConfiguration
The configuration being bound.
- configureBinder
- Action<BinderOptions>
Used to configure the BinderOptions.
Returns
The IServiceCollection so that additional calls can be chained.
- Attributes
Applies to
Configure<TOptions>(IServiceCollection, String, IConfiguration)
Registers a configuration instance that TOptions
will bind against.
public:
generic <typename TOptions>
where TOptions : class[System::Runtime::CompilerServices::Extension]
static Microsoft::Extensions::DependencyInjection::IServiceCollection ^ Configure(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, System::String ^ name, Microsoft::Extensions::Configuration::IConfiguration ^ config);
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Binding strongly typed objects to configuration values may require generating dynamic code at runtime.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("TOptions's dependent types may have their members trimmed. Ensure all required members are preserved.")]
public static Microsoft.Extensions.DependencyInjection.IServiceCollection Configure<TOptions>(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, string? name, Microsoft.Extensions.Configuration.IConfiguration config) where TOptions : class;
public static Microsoft.Extensions.DependencyInjection.IServiceCollection Configure<TOptions>(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, string? name, Microsoft.Extensions.Configuration.IConfiguration config) where TOptions : class;
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Binding strongly typed objects to configuration values may require generating dynamic code at runtime.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("TOptions's dependent types may have their members trimmed. Ensure all required members are preserved.")>]
static member Configure : Microsoft.Extensions.DependencyInjection.IServiceCollection * string * Microsoft.Extensions.Configuration.IConfiguration -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'Options : null)
static member Configure : Microsoft.Extensions.DependencyInjection.IServiceCollection * string * Microsoft.Extensions.Configuration.IConfiguration -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'Options : null)
<Extension()>
Public Function Configure(Of TOptions As Class) (services As IServiceCollection, name As String, config As IConfiguration) As IServiceCollection
Type Parameters
- TOptions
The type of options being configured.
Parameters
- services
- IServiceCollection
The IServiceCollection to add the services to.
- name
- String
The name of the options instance.
- config
- IConfiguration
The configuration being bound.
Returns
The IServiceCollection so that additional calls can be chained.
- Attributes
Applies to
Configure<TOptions>(IServiceCollection, String, IConfiguration, Action<BinderOptions>)
Registers a configuration instance that TOptions
will bind against.
public:
generic <typename TOptions>
where TOptions : class[System::Runtime::CompilerServices::Extension]
static Microsoft::Extensions::DependencyInjection::IServiceCollection ^ Configure(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, System::String ^ name, Microsoft::Extensions::Configuration::IConfiguration ^ config, Action<Microsoft::Extensions::Configuration::BinderOptions ^> ^ configureBinder);
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Binding strongly typed objects to configuration values may require generating dynamic code at runtime.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("TOptions's dependent types may have their members trimmed. Ensure all required members are preserved.")]
public static Microsoft.Extensions.DependencyInjection.IServiceCollection Configure<TOptions>(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, string? name, Microsoft.Extensions.Configuration.IConfiguration config, Action<Microsoft.Extensions.Configuration.BinderOptions>? configureBinder) where TOptions : class;
public static Microsoft.Extensions.DependencyInjection.IServiceCollection Configure<TOptions>(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, string? name, Microsoft.Extensions.Configuration.IConfiguration config, Action<Microsoft.Extensions.Configuration.BinderOptions>? configureBinder) where TOptions : class;
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Binding strongly typed objects to configuration values may require generating dynamic code at runtime.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("TOptions's dependent types may have their members trimmed. Ensure all required members are preserved.")>]
static member Configure : Microsoft.Extensions.DependencyInjection.IServiceCollection * string * Microsoft.Extensions.Configuration.IConfiguration * Action<Microsoft.Extensions.Configuration.BinderOptions> -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'Options : null)
static member Configure : Microsoft.Extensions.DependencyInjection.IServiceCollection * string * Microsoft.Extensions.Configuration.IConfiguration * Action<Microsoft.Extensions.Configuration.BinderOptions> -> Microsoft.Extensions.DependencyInjection.IServiceCollection (requires 'Options : null)
<Extension()>
Public Function Configure(Of TOptions As Class) (services As IServiceCollection, name As String, config As IConfiguration, configureBinder As Action(Of BinderOptions)) As IServiceCollection
Type Parameters
- TOptions
The type of options being configured.
Parameters
- services
- IServiceCollection
The IServiceCollection to add the services to.
- name
- String
The name of the options instance.
- config
- IConfiguration
The configuration being bound.
- configureBinder
- Action<BinderOptions>
Used to configure the BinderOptions.
Returns
The IServiceCollection so that additional calls can be chained.
- Attributes