IHostBuilder Interface

Definição

Uma abstração de inicialização do programa.A program initialization abstraction.

public interface class IHostBuilder
public interface IHostBuilder
type IHostBuilder = interface
Public Interface IHostBuilder
Derivado

Propriedades

Properties

Uma localização central para compartilhar o estado entre os componentes durante o processo de construção do host.A central location for sharing state between components during the host building process.

Métodos

Build()

Executar as ações determinadas para inicializar o host.Run the given actions to initialize the host. Isso pode ser chamado apenas uma vez.This can only be called once.

ConfigureAppConfiguration(Action<HostBuilderContext,IConfigurationBuilder>)

Define a configuração para o restante do processo de build e do aplicativo.Sets up the configuration for the remainder of the build process and application. Isso pode ser chamado várias vezes e os resultados serão aditivos.This can be called multiple times and the results will be additive. Os resultados estarão disponíveis em Configuration para operações subsequentes, bem como em Services.The results will be available at Configuration for subsequent operations, as well as in Services.

ConfigureContainer<TContainerBuilder>(Action<HostBuilderContext,TContainerBuilder>)

Habilita a configuração do contêiner de dependência instanciado.Enables configuring the instantiated dependency container. Isso pode ser chamado várias vezes e os resultados serão aditivos.This can be called multiple times and the results will be additive.

ConfigureHostConfiguration(Action<IConfigurationBuilder>)

Definir a configuração do próprio construtor.Set up the configuration for the builder itself. Isso será usado para inicializar o IHostEnvironment para uso posterior no processo de build.This will be used to initialize the IHostEnvironment for use later in the build process. Isso pode ser chamado várias vezes e os resultados serão aditivos.This can be called multiple times and the results will be additive.

ConfigureServices(Action<HostBuilderContext,IServiceCollection>)

Adiciona serviços ao contêiner.Adds services to the container. Isso pode ser chamado várias vezes e os resultados serão aditivos.This can be called multiple times and the results will be additive.

UseServiceProviderFactory<TContainerBuilder>(Func<HostBuilderContext,IServiceProviderFactory<TContainerBuilder>>)

Substitui a fábrica usada para criar o provedor de serviços.Overrides the factory used to create the service provider.

UseServiceProviderFactory<TContainerBuilder>(IServiceProviderFactory<TContainerBuilder>)

Substitui a fábrica usada para criar o provedor de serviços.Overrides the factory used to create the service provider.

Métodos de Extensão

Start(IHostBuilder)

Compila e inicia o host.Builds and starts the host.

StartAsync(IHostBuilder, CancellationToken)

Compila e inicia o host.Builds and starts the host.

ConfigureAppConfiguration(IHostBuilder, Action<IConfigurationBuilder>)

Define a configuração para o restante do processo de build e do aplicativo.Sets up the configuration for the remainder of the build process and application. Isso pode ser chamado várias vezes e os resultados serão aditivos.This can be called multiple times and the results will be additive. Os resultados estarão disponíveis em Configuration para operações subsequentes, bem como em Services.The results will be available at Configuration for subsequent operations, as well as in Services.

ConfigureContainer<TContainerBuilder>(IHostBuilder, Action<TContainerBuilder>)

Habilita a configuração do contêiner de dependência instanciado.Enables configuring the instantiated dependency container. Isso pode ser chamado várias vezes e os resultados serão aditivos.This can be called multiple times and the results will be additive.

ConfigureLogging(IHostBuilder, Action<HostBuilderContext,ILoggingBuilder>)

Adiciona um delegado para configurar o ILoggingBuilder fornecido.Adds a delegate for configuring the provided ILoggingBuilder. Isso pode ser chamado várias vezes.This may be called multiple times.

ConfigureLogging(IHostBuilder, Action<ILoggingBuilder>)

Adiciona um delegado para configurar o ILoggingBuilder fornecido.Adds a delegate for configuring the provided ILoggingBuilder. Isso pode ser chamado várias vezes.This may be called multiple times.

ConfigureServices(IHostBuilder, Action<IServiceCollection>)

Adiciona serviços ao contêiner.Adds services to the container. Isso pode ser chamado várias vezes e os resultados serão aditivos.This can be called multiple times and the results will be additive.

RunConsoleAsync(IHostBuilder, Action<ConsoleLifetimeOptions>, CancellationToken)

Habilita o suporte do console, compila e inicia o host e aguarda Ctrl+C ou o SIGTERM desligar.Enables console support, builds and starts the host, and waits for Ctrl+C or SIGTERM to shut down.

RunConsoleAsync(IHostBuilder, CancellationToken)

Habilita o suporte do console, compila e inicia o host e aguarda Ctrl+C ou o SIGTERM desligar.Enables console support, builds and starts the host, and waits for Ctrl+C or SIGTERM to shut down.

UseConsoleLifetime(IHostBuilder)

Escuta o Ctrl+C ou o SIGTERM e chama StopApplication() para iniciar o processo de desligamento.Listens for Ctrl+C or SIGTERM and calls StopApplication() to start the shutdown process. Isso desbloqueará extensões como RunAsync e WaitForShutdownAsync.This will unblock extensions like RunAsync and WaitForShutdownAsync.

UseConsoleLifetime(IHostBuilder, Action<ConsoleLifetimeOptions>)

Escuta o Ctrl+C ou o SIGTERM e chama StopApplication() para iniciar o processo de desligamento.Listens for Ctrl+C or SIGTERM and calls StopApplication() to start the shutdown process. Isso desbloqueará extensões como RunAsync e WaitForShutdownAsync.This will unblock extensions like RunAsync and WaitForShutdownAsync.

UseContentRoot(IHostBuilder, String)

Especifique o diretório raiz de conteúdo a ser usado pelo host.Specify the content root directory to be used by the host.

UseDefaultServiceProvider(IHostBuilder, Action<ServiceProviderOptions>)

Especificar o IServiceProvider para ser o padrão.Specify the IServiceProvider to be the default one.

UseDefaultServiceProvider(IHostBuilder, Action<HostBuilderContext,ServiceProviderOptions>)

Especificar o IServiceProvider para ser o padrão.Specify the IServiceProvider to be the default one.

UseEnvironment(IHostBuilder, String)

Especificar o ambiente a ser usado pelo host.Specify the environment to be used by the host.

UseSystemd(IHostBuilder)

Define o tempo de vida do host como SystemdLifetime, fornece mensagens de notificação para o aplicativo iniciando e parando e configura o registro em log do console para o formato do systemd.Sets the host lifetime to SystemdLifetime, provides notification messages for application started and stopping, and configures console logging to the systemd format.

UseWindowsService(IHostBuilder)

Define o tempo de vida do host como WindowsServiceLifetime, define a raiz do conteúdo e habilita o registro em log para o log de eventos com o nome do aplicativo como o nome de origem padrão.Sets the host lifetime to WindowsServiceLifetime, sets the Content Root, and enables logging to the event log with the application name as the default source name.

Aplica-se a