Class ApplicationEventHandler
A plugin type that allows developers to execute code during the Umbraco bootup process
Inheritance
Namespace:System.Dynamic.ExpandoObject
Assembly:Umbraco.Core.dll
Syntax
public abstract class ApplicationEventHandler : IApplicationEventHandler, IApplicationStartupHandler, IDiscoverable
Remarks
Allows you to override the methods that you would like to execute code for: ApplicationInitialized, ApplicationStarting, ApplicationStarted.
By default none of these methods will execute if the Umbraco application is not configured or if the Umbraco database is not configured, however if you need these methods to execute even if either of these are not configured you can override the properties: ExecuteWhenApplicationNotConfigured and ExecuteWhenDatabaseNotConfigured
Properties
ExecuteWhenApplicationNotConfigured
A flag to determine if the overridable methods for this class will execute even if the Umbraco application is not configured
Declaration
protected virtual bool ExecuteWhenApplicationNotConfigured { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
An Umbraco Application is not configured when it requires a new install or upgrade. When the latest version in the assembly does not match the version in the config.
ExecuteWhenDatabaseNotConfigured
A flag to determine if the overridable methods for this class will execute even if the Umbraco database is not configured
Declaration
protected virtual bool ExecuteWhenDatabaseNotConfigured { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
The Umbraco database is not configured when we cannot connect to the database or when the database tables are not installed.
Methods
ApplicationInitialized(UmbracoApplicationBase, ApplicationContext)
Overridable method to execute when the ApplicationContext is created and other static objects that require initialization have been setup
Declaration
protected virtual void ApplicationInitialized(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
Parameters
Type | Name | Description |
---|---|---|
UmbracoApplicationBase | umbracoApplication | |
ApplicationContext | applicationContext |
ApplicationStarted(UmbracoApplicationBase, ApplicationContext)
Overridable method to execute when Bootup is completed, this allows you to perform any other bootup logic required for the application. Resolution is frozen so now they can be used to resolve instances.
Declaration
protected virtual void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
Parameters
Type | Name | Description |
---|---|---|
UmbracoApplicationBase | umbracoApplication | |
ApplicationContext | applicationContext |
ApplicationStarting(UmbracoApplicationBase, ApplicationContext)
Overridable method to execute when All resolvers have been initialized but resolution is not frozen so they can be modified in this method
Declaration
protected virtual void ApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
Parameters
Type | Name | Description |
---|---|---|
UmbracoApplicationBase | umbracoApplication | |
ApplicationContext | applicationContext |
OnApplicationInitialized(UmbracoApplicationBase, ApplicationContext)
Declaration
public void OnApplicationInitialized(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
Parameters
Type | Name | Description |
---|---|---|
UmbracoApplicationBase | umbracoApplication | |
ApplicationContext | applicationContext |
OnApplicationStarted(UmbracoApplicationBase, ApplicationContext)
Declaration
public void OnApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
Parameters
Type | Name | Description |
---|---|---|
UmbracoApplicationBase | umbracoApplication | |
ApplicationContext | applicationContext |
OnApplicationStarting(UmbracoApplicationBase, ApplicationContext)
Declaration
public void OnApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
Parameters
Type | Name | Description |
---|---|---|
UmbracoApplicationBase | umbracoApplication | |
ApplicationContext | applicationContext |