Delen via


WebHostBuilderExtensions.UseStartup Method

Definition

Overloads

UseStartup(IWebHostBuilder, Type)

Specify the startup type to be used by the web host.

UseStartup<TStartup>(IWebHostBuilder)

Specify the startup type to be used by the web host.

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

Specify a factory that creates the startup instance to be used by the web host.

UseStartup(IWebHostBuilder, Type)

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

Specify the startup type to be used by the web host.

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

Parameters

hostBuilder
IWebHostBuilder

The IWebHostBuilder to configure.

startupType
Type

The Type to be used.

Returns

The IWebHostBuilder.

Applies to

UseStartup<TStartup>(IWebHostBuilder)

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

Specify the startup type to be used by the web host.

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

Type Parameters

TStartup

The type containing the startup methods for the application.

Parameters

hostBuilder
IWebHostBuilder

The IWebHostBuilder to configure.

Returns

The IWebHostBuilder.

Applies to

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

Source:
WebHostBuilderExtensions.cs

Specify a factory that creates the startup instance to be used by the web host.

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

Type Parameters

TStartup

Parameters

hostBuilder
IWebHostBuilder

The IWebHostBuilder to configure.

startupFactory
Func<WebHostBuilderContext,TStartup>

A delegate that specifies a factory for the startup class.

Returns

The IWebHostBuilder.

Remarks

When in a trimmed app, all public methods of TStartup are preserved. This should match the Startup type directly (and not a base type).

Applies to