Table of Contents

Class HostControlHostExtensions

Namespace
Invex.Extensions.Hosting.Control
Assembly
Invex.Extensions.Hosting.dll

Provides extension methods for Microsoft.Extensions.DependencyInjection.IServiceCollection to add host control capabilities.

[PublicAPI]
public static class HostControlHostExtensions
Inheritance
object
HostControlHostExtensions

Methods

AddHostControl(IServiceCollection)

Adds the IHostControl service to the Microsoft.Extensions.DependencyInjection.IServiceCollection.

public static IServiceCollection AddHostControl(this IServiceCollection services)

Parameters

services IServiceCollection

The Microsoft.Extensions.DependencyInjection.IServiceCollection to add the IHostControl service to.

Returns

IServiceCollection

The services instance so that additional calls can be chained.

Examples

builder.Services.AddHostControl();

Remarks

IHostControl is registered as a singleton that wraps the host's Microsoft.Extensions.Hosting.IHostApplicationLifetime, adding the ability to stop the application with a specific exit code via StopApplication(int).