WebHostBuilderExtensions.UseStartup 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
UseStartup(IWebHostBuilder, Type) |
指定 Web 主機要使用的啟動類型。 |
UseStartup<TStartup>(IWebHostBuilder) |
指定 Web 主機要使用的啟動類型。 |
UseStartup<TStartup>(IWebHostBuilder, Func<WebHostBuilderContext,TStartup>) |
指定建立 Web 主機所要使用的啟動實例的處理站。 |
UseStartup(IWebHostBuilder, Type)
指定 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。
傳回
適用於
UseStartup<TStartup>(IWebHostBuilder)
指定 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。
傳回
適用於
UseStartup<TStartup>(IWebHostBuilder, Func<WebHostBuilderContext,TStartup>)
指定建立 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>
委派,指定啟動類別的處理站。
傳回
備註
在修剪的應用程式中時,會保留 的所有公用方法 TStartup
。 這應該會直接比對啟動類型 (,而不是基底類型) 。