IHostBuilder.ConfigureServices 方法

定义

向容器添加服务。 可多次进行调用,并累加结果。

public:
 Microsoft::Extensions::Hosting::IHostBuilder ^ ConfigureServices(Action<Microsoft::Extensions::Hosting::HostBuilderContext ^, Microsoft::Extensions::DependencyInjection::IServiceCollection ^> ^ configureDelegate);
public Microsoft.Extensions.Hosting.IHostBuilder ConfigureServices (Action<Microsoft.Extensions.Hosting.HostBuilderContext,Microsoft.Extensions.DependencyInjection.IServiceCollection> configureDelegate);
abstract member ConfigureServices : Action<Microsoft.Extensions.Hosting.HostBuilderContext, Microsoft.Extensions.DependencyInjection.IServiceCollection> -> Microsoft.Extensions.Hosting.IHostBuilder
Public Function ConfigureServices (configureDelegate As Action(Of HostBuilderContext, IServiceCollection)) As IHostBuilder

参数

configureDelegate
Action<HostBuilderContext,IServiceCollection>

配置将用于构造 IServiceProviderIServiceCollection 的委托。

返回

用于链接的相同 IHostBuilder 实例。

适用于