共用方式為


HostingHostBuilderExtensions.ConfigureServices 方法

定義

將服務新增至容器。 這可以呼叫多次,結果會進行累加。

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::Hosting::IHostBuilder ^ ConfigureServices(Microsoft::Extensions::Hosting::IHostBuilder ^ hostBuilder, Action<Microsoft::Extensions::DependencyInjection::IServiceCollection ^> ^ configureDelegate);
public static Microsoft.Extensions.Hosting.IHostBuilder ConfigureServices (this Microsoft.Extensions.Hosting.IHostBuilder hostBuilder, Action<Microsoft.Extensions.DependencyInjection.IServiceCollection> configureDelegate);
static member ConfigureServices : Microsoft.Extensions.Hosting.IHostBuilder * Action<Microsoft.Extensions.DependencyInjection.IServiceCollection> -> Microsoft.Extensions.Hosting.IHostBuilder
<Extension()>
Public Function ConfigureServices (hostBuilder As IHostBuilder, configureDelegate As Action(Of IServiceCollection)) As IHostBuilder

參數

hostBuilder
IHostBuilder

要設定的 IHostBuilder

configureDelegate
Action<IServiceCollection>

用於設定 IServiceCollection 的委派。

傳回

用於鏈結的相同 IHostBuilder 執行個體。

適用於