HostBuilder Classe
Definição
Um utilitário de inicialização do programa.A program initialization utility.
public ref class HostBuilder : Microsoft::Extensions::Hosting::IHostBuilder
public class HostBuilder : Microsoft.Extensions.Hosting.IHostBuilder
type HostBuilder = class
interface IHostBuilder
Public Class HostBuilder
Implements IHostBuilder
- Herança
-
HostBuilder
- Implementações
Construtores
| HostBuilder() |
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. O Configuration transmitido é a configuração do host compilada partindo de chamadas para ConfigureHostConfiguration(Action<IConfigurationBuilder>).The Configuration passed in is the host's configuration built from calls to ConfigureHostConfiguration(Action<IConfigurationBuilder>). 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. Depois que todas as chamadas forem processadas, Configuration será atualizado com os resultados para futuras etapas de compilação.After all calls have been processed, Configuration will be updated with the results for future build steps. A configuração resultante também estará disponível no contêiner DI Services.The resulting configuration will also be available in the Services DI Container. |
| 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. |
| Equals(Object) |
Determina se o objeto especificado é igual ao objeto atual.Determines whether the specified object is equal to the current object. (Herdado de Object) |
| GetHashCode() |
Serve como a função de hash padrão.Serves as the default hash function. (Herdado de Object) |
| GetType() |
Obtém o Type da instância atual.Gets the Type of the current instance. (Herdado de Object) |
| MemberwiseClone() |
Cria uma cópia superficial do Object atual.Creates a shallow copy of the current Object. (Herdado de Object) |
| ToString() |
Retorna uma cadeia de caracteres que representa o objeto atual.Returns a string that represents the current object. (Herdado de Object) |
| 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. |