Class RuntimeState
Represents the state of the Umbraco runtime.
Inheritance
Namespace: Umbraco.Cms.Infrastructure.Runtime
Assembly: Umbraco.Infrastructure.dll
Syntax
public class RuntimeState : IRuntimeState
Constructors
View SourceRuntimeState(IOptions<GlobalSettings>, IOptions<UnattendedSettings>, IUmbracoVersion, IUmbracoDatabaseFactory, ILogger<RuntimeState>, PendingPackageMigrations, IConflictingRouteService, IEnumerable<IDatabaseProviderMetadata>, IRuntimeModeValidationService)
Initializes a new instance of the RuntimeState class with the specified configuration and services.
Declaration
[Obsolete("Please use the constructor taking all parameters. Scheduled for removal in Umbraco 18.")]
public RuntimeState(IOptions<GlobalSettings> globalSettings, IOptions<UnattendedSettings> unattendedSettings, IUmbracoVersion umbracoVersion, IUmbracoDatabaseFactory databaseFactory, ILogger<RuntimeState> logger, PendingPackageMigrations packageMigrationState, IConflictingRouteService conflictingRouteService, IEnumerable<IDatabaseProviderMetadata> databaseProviderMetadata, IRuntimeModeValidationService runtimeModeValidationService)
Parameters
| Type | Name | Description |
|---|---|---|
| IOptions<GlobalSettings> | globalSettings | The global settings for the Umbraco application. |
| IOptions<UnattendedSettings> | unattendedSettings | The unattended installation and upgrade settings. |
| IUmbracoVersion | umbracoVersion | Provides information about the current Umbraco version. |
| IUmbracoDatabaseFactory | databaseFactory | Factory for creating Umbraco database connections. |
| ILogger<RuntimeState> | logger | The logger used for logging runtime state information. |
| PendingPackageMigrations | packageMigrationState | Tracks the state of pending package migrations. |
| IConflictingRouteService | conflictingRouteService | Service for detecting conflicting routes in the application. |
| IEnumerable<IDatabaseProviderMetadata> | databaseProviderMetadata | A collection of metadata describing available database providers. |
| IRuntimeModeValidationService | runtimeModeValidationService | Service for validating the runtime mode of the application. |
RuntimeState(IOptions<GlobalSettings>, IOptions<UnattendedSettings>, IUmbracoVersion, IUmbracoDatabaseFactory, ILogger<RuntimeState>, PendingPackageMigrations, IConflictingRouteService, IEnumerable<IDatabaseProviderMetadata>, IRuntimeModeValidationService, IDatabaseAvailabilityCheck)
Initializes a new instance of the RuntimeState class.
Declaration
public RuntimeState(IOptions<GlobalSettings> globalSettings, IOptions<UnattendedSettings> unattendedSettings, IUmbracoVersion umbracoVersion, IUmbracoDatabaseFactory databaseFactory, ILogger<RuntimeState> logger, PendingPackageMigrations packageMigrationState, IConflictingRouteService conflictingRouteService, IEnumerable<IDatabaseProviderMetadata> databaseProviderMetadata, IRuntimeModeValidationService runtimeModeValidationService, IDatabaseAvailabilityCheck databaseAvailabilityCheck)
Parameters
| Type | Name | Description |
|---|---|---|
| IOptions<GlobalSettings> | globalSettings | The global settings for the Umbraco application. |
| IOptions<UnattendedSettings> | unattendedSettings | The unattended installation and upgrade settings. |
| IUmbracoVersion | umbracoVersion | Provides information about the current Umbraco version. |
| IUmbracoDatabaseFactory | databaseFactory | Factory for creating Umbraco database connections. |
| ILogger<RuntimeState> | logger | The logger used for logging runtime state information. |
| PendingPackageMigrations | packageMigrationState | Tracks the state of pending package migrations. |
| IConflictingRouteService | conflictingRouteService | Service for detecting conflicting routes in the application. |
| IEnumerable<IDatabaseProviderMetadata> | databaseProviderMetadata | A collection of metadata for available database providers. |
| IRuntimeModeValidationService | runtimeModeValidationService | Service for validating the current runtime mode. |
| IDatabaseAvailabilityCheck | databaseAvailabilityCheck | Service to check the availability of the database. |
Properties
View SourceBootFailedException
Gets the exception that caused the boot to fail.
Declaration
public BootFailedException? BootFailedException { get; }
Property Value
| Type | Description |
|---|---|
| BootFailedException |
CurrentMigrationState
Gets the current migration state.
Declaration
public string? CurrentMigrationState { get; }
Property Value
| Type | Description |
|---|---|
| string |
CurrentMigrationVersion
Gets the semantic version corresponding to the current migration state.
Declaration
public SemVersion? CurrentMigrationVersion { get; }
Property Value
| Type | Description |
|---|---|
| SemVersion |
FinalMigrationState
Gets the final migration state.
Declaration
public string? FinalMigrationState { get; }
Property Value
| Type | Description |
|---|---|
| string |
Level
Gets the runtime level of execution.
Declaration
public RuntimeLevel Level { get; }
Property Value
| Type | Description |
|---|---|
| RuntimeLevel |
Reason
Gets the reason for the runtime level of execution.
Declaration
public RuntimeLevelReason Reason { get; }
Property Value
| Type | Description |
|---|---|
| RuntimeLevelReason |
SemanticVersion
Gets the semantic version of the executing code.
Declaration
public SemVersion SemanticVersion { get; }
Property Value
| Type | Description |
|---|---|
| SemVersion |
StartupState
Returns any state data that was collected during startup
Declaration
public IReadOnlyDictionary<string, object> StartupState { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyDictionary<string, object> |
Version
Gets the version of the executing code.
Declaration
public Version Version { get; }
Property Value
| Type | Description |
|---|---|
| Version |
VersionComment
Gets the version comment of the executing code.
Declaration
public string VersionComment { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
View SourceBooting()
Creates and returns the initial RuntimeState instance representing the booting state of the application.
Declaration
public static RuntimeState Booting()
Returns
| Type | Description |
|---|---|
| RuntimeState | The initial RuntimeState instance representing the booting state. |
Configure(RuntimeLevel, RuntimeLevelReason, Exception?)
Configures the runtime state by setting the specified runtime level and reason, and optionally records an exception that caused the boot process to fail.
Declaration
public void Configure(RuntimeLevel level, RuntimeLevelReason reason, Exception? bootFailedException = null)
Parameters
| Type | Name | Description |
|---|---|---|
| RuntimeLevel | level | The RuntimeLevel to set for the runtime state. |
| RuntimeLevelReason | reason | The RuntimeLevelReason indicating why the runtime level is being set. |
| Exception | bootFailedException | An optional System.Exception that caused the boot to fail. If provided, it will be wrapped in a BootFailedException and stored. |
DetermineRuntimeLevel()
Determines the runtime level.
Declaration
public void DetermineRuntimeLevel()