WebHostBuilderExtensions.UseStartup 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
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。
返回
适用于
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。
返回
适用于
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>
为启动类指定工厂的委托。
返回
注解
在已剪裁的应用中,将保留 的所有公共方法 TStartup
。 这应与直接 (启动类型匹配,而不是与基类型) 匹配。