英語で読む

次の方法で共有


HostingHostBuilderExtensions.UseDefaultServiceProvider Method

Definition

Overloads

UseDefaultServiceProvider(IHostBuilder, Action<HostBuilderContext,ServiceProviderOptions>)

Source:
HostingHostBuilderExtensions.cs
Source:
HostingHostBuilderExtensions.cs
Source:
HostingHostBuilderExtensions.cs

Specifies the IServiceProvider to be the default one.

public static Microsoft.Extensions.Hosting.IHostBuilder UseDefaultServiceProvider (this Microsoft.Extensions.Hosting.IHostBuilder hostBuilder, Action<Microsoft.Extensions.Hosting.HostBuilderContext,Microsoft.Extensions.DependencyInjection.ServiceProviderOptions> configure);

Parameters

hostBuilder
IHostBuilder

The IHostBuilder to configure.

configure
Action<HostBuilderContext,ServiceProviderOptions>

The delegate that configures the IServiceProvider.

Returns

The IHostBuilder.

Applies to

.NET 9 (package-provided) およびその他のバージョン
製品 バージョン
.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)

UseDefaultServiceProvider(IHostBuilder, Action<ServiceProviderOptions>)

Source:
HostingHostBuilderExtensions.cs
Source:
HostingHostBuilderExtensions.cs
Source:
HostingHostBuilderExtensions.cs

Specifies the IServiceProvider to be the default one.

public static Microsoft.Extensions.Hosting.IHostBuilder UseDefaultServiceProvider (this Microsoft.Extensions.Hosting.IHostBuilder hostBuilder, Action<Microsoft.Extensions.DependencyInjection.ServiceProviderOptions> configure);

Parameters

hostBuilder
IHostBuilder

The IHostBuilder to configure.

configure
Action<ServiceProviderOptions>

The delegate that configures the IServiceProvider.

Returns

The IHostBuilder.

Applies to

.NET 9 (package-provided) およびその他のバージョン
製品 バージョン
.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)