Table of Contents

Class TerminalHostedService

Namespace
PerpetualIntelligence.Terminal.Hosting
Assembly
PerpetualIntelligence.Terminal.dll

The hosted service to manage the application lifetime and terminal customization.

public class TerminalHostedService : IHostedService
Inheritance
TerminalHostedService
Implements
Inherited Members

Constructors

TerminalHostedService(IServiceProvider, TerminalOptions, ILogger<TerminalHostedService>)

Initializes a new instance.

public TerminalHostedService(IServiceProvider serviceProvider, TerminalOptions options, ILogger<TerminalHostedService> logger)

Parameters

serviceProvider IServiceProvider

The service provider.

options TerminalOptions

The configuration options.

logger ILogger<TerminalHostedService>

The logger.

Methods

CheckHostApplicationConfigurationAsync(TerminalOptions)

Allows the host application to perform additional configuration option checks.

protected virtual Task CheckHostApplicationConfigurationAsync(TerminalOptions options)

Parameters

options TerminalOptions

Returns

Task

OnStarted()

Triggered when the application host has fully started.

protected virtual void OnStarted()

OnStopped()

Triggered when the application host has completed a graceful shutdown. The application will not exit until all callbacks registered on this token have completed.

protected virtual void OnStopped()

OnStopping()

Triggered when the application host is starting a graceful shutdown. Shutdown will block until all callbacks registered on this token have completed.

protected virtual void OnStopping()

PrintHostApplicationHeaderAsync()

Allows the host application to print the custom header.

protected virtual Task PrintHostApplicationHeaderAsync()

Returns

Task

PrintHostApplicationLicensingAsync(License)

Allows host application to print custom licensing information.

protected virtual Task PrintHostApplicationLicensingAsync(License license)

Parameters

license License

Returns

Task

RegisterHostApplicationEventsAsync(IHostApplicationLifetime)

Allows the application to register its custom IHostApplicationLifetime events.

protected virtual Task RegisterHostApplicationEventsAsync(IHostApplicationLifetime hostApplicationLifetime)

Parameters

hostApplicationLifetime IHostApplicationLifetime

Returns

Task

StartAsync(CancellationToken)

Starts the hosted service asynchronously.

public Task StartAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

The cancellation token.

Returns

Task

StopAsync(CancellationToken)

Stops the hosted service asynchronously.

public Task StopAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

The cancellation token.

Returns

Task