共用方式為


WebHostBuilderExtensions.UseStartup 方法

定義

多載

UseStartup(IWebHostBuilder, Type)

指定 Web 主機要使用的啟動類型。

UseStartup<TStartup>(IWebHostBuilder)

指定 Web 主機要使用的啟動類型。

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

指定建立 Web 主機所要使用的啟動實例的處理站。

UseStartup(IWebHostBuilder, Type)

來源:
WebHostBuilderExtensions.cs
來源:
WebHostBuilderExtensions.cs
來源:
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)

來源:
WebHostBuilderExtensions.cs
來源:
WebHostBuilderExtensions.cs
來源:
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>)

來源:
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 。 這應該會直接比對啟動類型 (,而不是基底類型) 。

適用於