WebHostBuilderExtensions.UseStartup 方法

定义

重载

UseStartup(IWebHostBuilder, Type)

指定 Web 主机要使用的启动类型。

UseStartup<TStartup>(IWebHostBuilder)

指定 Web 主机要使用的启动类型。

UseStartup<TStartup>(IWebHostBuilder, Func<WebHostBuilderContext,TStartup>)

指定一个工厂,用于创建 Web 主机要使用的启动实例。

UseStartup(IWebHostBuilder, Type)

Source:
WebHostBuilderExtensions.cs
Source:
WebHostBuilderExtensions.cs
Source:
WebHostBuilderExtensions.cs

指定 Web 主机要使用的启动类型。

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::AspNetCore::Hosting::IWebHostBuilder ^ UseStartup(Microsoft::AspNetCore::Hosting::IWebHostBuilder ^ hostBuilder, Type ^ startupType);
public static Microsoft.AspNetCore.Hosting.IWebHostBuilder UseStartup (this Microsoft.AspNetCore.Hosting.IWebHostBuilder hostBuilder, Type startupType);
static member UseStartup : Microsoft.AspNetCore.Hosting.IWebHostBuilder * Type -> Microsoft.AspNetCore.Hosting.IWebHostBuilder
<Extension()>
Public Function UseStartup (hostBuilder As IWebHostBuilder, startupType As Type) As IWebHostBuilder

参数

hostBuilder
IWebHostBuilder

要配置的 IWebHostBuilder

startupType
Type

要使用的 Type

返回

IWebHostBuilder

适用于

UseStartup<TStartup>(IWebHostBuilder)

Source:
WebHostBuilderExtensions.cs
Source:
WebHostBuilderExtensions.cs
Source:
WebHostBuilderExtensions.cs

指定 Web 主机要使用的启动类型。

public:
generic <typename TStartup>
 where TStartup : class[System::Runtime::CompilerServices::Extension]
 static Microsoft::AspNetCore::Hosting::IWebHostBuilder ^ UseStartup(Microsoft::AspNetCore::Hosting::IWebHostBuilder ^ hostBuilder);
public static Microsoft.AspNetCore.Hosting.IWebHostBuilder UseStartup<TStartup> (this Microsoft.AspNetCore.Hosting.IWebHostBuilder hostBuilder) where TStartup : class;
static member UseStartup : Microsoft.AspNetCore.Hosting.IWebHostBuilder -> Microsoft.AspNetCore.Hosting.IWebHostBuilder (requires 'Startup : null)
<Extension()>
Public Function UseStartup(Of TStartup As Class) (hostBuilder As IWebHostBuilder) As IWebHostBuilder

类型参数

TStartup

包含应用程序的启动方法的类型。

参数

hostBuilder
IWebHostBuilder

要配置的 IWebHostBuilder

返回

IWebHostBuilder

适用于

UseStartup<TStartup>(IWebHostBuilder, Func<WebHostBuilderContext,TStartup>)

Source:
WebHostBuilderExtensions.cs

指定一个工厂,用于创建 Web 主机要使用的启动实例。

public:
generic <typename TStartup>
 where TStartup : class[System::Runtime::CompilerServices::Extension]
 static Microsoft::AspNetCore::Hosting::IWebHostBuilder ^ UseStartup(Microsoft::AspNetCore::Hosting::IWebHostBuilder ^ hostBuilder, Func<Microsoft::AspNetCore::Hosting::WebHostBuilderContext ^, TStartup> ^ startupFactory);
public static Microsoft.AspNetCore.Hosting.IWebHostBuilder UseStartup<TStartup> (this Microsoft.AspNetCore.Hosting.IWebHostBuilder hostBuilder, Func<Microsoft.AspNetCore.Hosting.WebHostBuilderContext,TStartup> startupFactory) where TStartup : class;
static member UseStartup : Microsoft.AspNetCore.Hosting.IWebHostBuilder * Func<Microsoft.AspNetCore.Hosting.WebHostBuilderContext, 'Startup (requires 'Startup : null)> -> Microsoft.AspNetCore.Hosting.IWebHostBuilder (requires 'Startup : null)
<Extension()>
Public Function UseStartup(Of TStartup As Class) (hostBuilder As IWebHostBuilder, startupFactory As Func(Of WebHostBuilderContext, TStartup)) As IWebHostBuilder

类型参数

TStartup

参数

hostBuilder
IWebHostBuilder

要配置的 IWebHostBuilder

startupFactory
Func<WebHostBuilderContext,TStartup>

为启动类指定工厂的委托。

返回

IWebHostBuilder

注解

在已剪裁的应用中,将保留 的所有公共方法 TStartup 。 这应与直接 (启动类型匹配,而不是与基类型) 匹配。

适用于