OptionsServiceCollectionExtensions.ConfigureOptions Method

Definition

Overloads

ConfigureOptions(IServiceCollection, Object)

Source:
OptionsServiceCollectionExtensions.cs
Source:
OptionsServiceCollectionExtensions.cs
Source:
OptionsServiceCollectionExtensions.cs

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

C#
public static Microsoft.Extensions.DependencyInjection.IServiceCollection ConfigureOptions(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, object configureInstance);

Parameters

services
IServiceCollection

The IServiceCollection to add the services to.

configureInstance
Object

The instance that will configure options.

Returns

The IServiceCollection so that additional calls can be chained.

Applies to

.NET 9 (package-provided) y otras versiones
Producto Versiones
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided), 2.1 (package-provided)

ConfigureOptions(IServiceCollection, Type)

Source:
OptionsServiceCollectionExtensions.cs
Source:
OptionsServiceCollectionExtensions.cs
Source:
OptionsServiceCollectionExtensions.cs

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

C#
public static Microsoft.Extensions.DependencyInjection.IServiceCollection ConfigureOptions(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Type configureType);

Parameters

services
IServiceCollection

The IServiceCollection to add the services to.

configureType
Type

The type that will configure options.

Returns

The IServiceCollection so that additional calls can be chained.

Applies to

.NET 9 (package-provided) y otras versiones
Producto Versiones
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided), 2.1 (package-provided)

ConfigureOptions<TConfigureOptions>(IServiceCollection)

Source:
OptionsServiceCollectionExtensions.cs
Source:
OptionsServiceCollectionExtensions.cs
Source:
OptionsServiceCollectionExtensions.cs

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

C#
public static Microsoft.Extensions.DependencyInjection.IServiceCollection ConfigureOptions<TConfigureOptions>(this Microsoft.Extensions.DependencyInjection.IServiceCollection services) where TConfigureOptions : class;

Type Parameters

TConfigureOptions

The type that will configure options.

Parameters

services
IServiceCollection

The IServiceCollection to add the services to.

Returns

The IServiceCollection so that additional calls can be chained.

Applies to

.NET 9 (package-provided) y otras versiones
Producto Versiones
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided), 2.1 (package-provided)