Class HostControlHostExtensions
Provides extension methods for Microsoft.Extensions.DependencyInjection.IServiceCollection to add host control capabilities.
[PublicAPI]
public static class HostControlHostExtensions
- Inheritance
-
objectHostControlHostExtensions
Methods
AddHostControl(IServiceCollection)
Adds the IHostControl service to the Microsoft.Extensions.DependencyInjection.IServiceCollection.
public static IServiceCollection AddHostControl(this IServiceCollection services)
Parameters
servicesIServiceCollectionThe Microsoft.Extensions.DependencyInjection.IServiceCollection to add the IHostControl service to.
Returns
- IServiceCollection
The
servicesinstance 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).