ConsoleLifetime Constructors

Definition

Overloads

ConsoleLifetime(IOptions<ConsoleLifetimeOptions>, IHostEnvironment, IHostApplicationLifetime, IOptions<HostOptions>)

Initializes a ConsoleLifetime instance using the specified console lifetime options, host environment, host application lifetime and host options.

ConsoleLifetime(IOptions<ConsoleLifetimeOptions>, IHostEnvironment, IHostApplicationLifetime, IOptions<HostOptions>, ILoggerFactory)

Initializes a ConsoleLifetime instance using the specified console lifetime options, host environment, host options and logger factory.

ConsoleLifetime(IOptions<ConsoleLifetimeOptions>, IHostEnvironment, IHostApplicationLifetime, IOptions<HostOptions>)

Source:
ConsoleLifetime.cs
Source:
ConsoleLifetime.cs
Source:
ConsoleLifetime.cs

Initializes a ConsoleLifetime instance using the specified console lifetime options, host environment, host application lifetime and host options.

public ConsoleLifetime (Microsoft.Extensions.Options.IOptions<Microsoft.Extensions.Hosting.ConsoleLifetimeOptions> options, Microsoft.Extensions.Hosting.IHostEnvironment environment, Microsoft.Extensions.Hosting.IHostApplicationLifetime applicationLifetime, Microsoft.Extensions.Options.IOptions<Microsoft.Extensions.Hosting.HostOptions> hostOptions);

Parameters

options
IOptions<ConsoleLifetimeOptions>

An object used to retrieve ConsoleLifetimeOptions instances.

environment
IHostEnvironment

An object that contains information about the hosting environment an application is running in.

applicationLifetime
IHostApplicationLifetime

An object that allows consumers to be notified of application lifetime events.

hostOptions
IOptions<HostOptions>

An object used to retrieve Microsoft.Extensions.Hosting.Internal.ConsoleLifetime.HostOptions instances.

Exceptions

options or environment or applicationLifetime or hostOptions is null.

Applies to

.NET 9 (package-provided) e altre versioni
Prodotto Versioni
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided), 2.1 (package-provided)

ConsoleLifetime(IOptions<ConsoleLifetimeOptions>, IHostEnvironment, IHostApplicationLifetime, IOptions<HostOptions>, ILoggerFactory)

Source:
ConsoleLifetime.cs
Source:
ConsoleLifetime.cs
Source:
ConsoleLifetime.cs

Initializes a ConsoleLifetime instance using the specified console lifetime options, host environment, host options and logger factory.

public ConsoleLifetime (Microsoft.Extensions.Options.IOptions<Microsoft.Extensions.Hosting.ConsoleLifetimeOptions> options, Microsoft.Extensions.Hosting.IHostEnvironment environment, Microsoft.Extensions.Hosting.IHostApplicationLifetime applicationLifetime, Microsoft.Extensions.Options.IOptions<Microsoft.Extensions.Hosting.HostOptions> hostOptions, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory);

Parameters

options
IOptions<ConsoleLifetimeOptions>

An object used to retrieve ConsoleLifetimeOptions instances

environment
IHostEnvironment

An object that contains information about the hosting environment an application is running in.

applicationLifetime
IHostApplicationLifetime

An object that allows consumers to be notified of application lifetime events.

hostOptions
IOptions<HostOptions>

An object used to retrieve Microsoft.Extensions.Hosting.Internal.ConsoleLifetime.HostOptions instances.

loggerFactory
ILoggerFactory

An object to configure the logging system and create instances of ILogger from the registered ILoggerProvider.

Exceptions

options or environment or applicationLifetime or hostOptions or loggerFactory is null.

Applies to

.NET 9 (package-provided) e altre versioni
Prodotto Versioni
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided), 2.1 (package-provided)