Class TerminalHostedService
The hosted service to manage the application lifetime and terminal customization.
public abstract class TerminalHostedService : IHostedService
- Inheritance
-
TerminalHostedService
- Implements
- Inherited Members
Constructors
TerminalHostedService(IServiceProvider, IOptions<TerminalOptions>, ITerminalConsole, ITerminalExceptionHandler, ILogger<TerminalHostedService>)
Initializes a new instance.
public TerminalHostedService(IServiceProvider serviceProvider, IOptions<TerminalOptions> terminalOptions, ITerminalConsole terminalConsole, ITerminalExceptionHandler terminalExceptionHandler, ILogger<TerminalHostedService> logger)
Parameters
serviceProvider
IServiceProviderThe service provider.
terminalOptions
IOptions<TerminalOptions>The configuration options.
terminalConsole
ITerminalConsoleThe terminal console.
terminalExceptionHandler
ITerminalExceptionHandlerThe exception handler.
logger
ILogger<TerminalHostedService>The logger.
Properties
Options
The terminal configuration options.
protected IOptions<TerminalOptions> Options { get; }
Property Value
ServiceProvider
The service provider.
protected IServiceProvider ServiceProvider { get; }
Property Value
TerminalConsole
The terminal console.
protected ITerminalConsole TerminalConsole { get; }
Property Value
Methods
ConfigureLifetimeAsync()
Configures the application's lifetime with IHostApplicationLifetime.
protected abstract Task ConfigureLifetimeAsync()
Returns
StartAsync(CancellationToken)
Starts the hosted service asynchronously.
public Task StartAsync(CancellationToken cancellationToken)
Parameters
cancellationToken
CancellationTokenThe cancellation token.
Returns
StopAsync(CancellationToken)
Stops the hosted service asynchronously.
public Task StopAsync(CancellationToken cancellationToken)
Parameters
cancellationToken
CancellationTokenThe cancellation token.