Class ApplicationEventsResolver
A resolver to return all IApplicationEvents objects
Inheritance
Namespace:System.Dynamic.ExpandoObject
Assembly:Umbraco.Core.dll
Syntax
public sealed class ApplicationEventsResolver : ManyObjectsResolverBase<ApplicationEventsResolver, IApplicationEventHandler>, IDisposable
Remarks
This is disposable because after the app has started it should be disposed to release any memory being occupied by instances.
Ordering handlers: handlers are ordered by (ascending) weight. By default, handlers from the Umbraco.* or Concorde.* assemblies have a -100 weight whereas any other handler has a weight of +100. A custom weight can be assigned to a handler by marking the class with the WeightAttribute. For example, the CacheRefresherEventHandler is marked with [Weight(int.MinValue)] because its events need to run before anything else. Positive weights are considered "user-space" while negative weights are "core". Finally, users can register a filter to process the list (after it has been ordered) and re-order it, or remove handlers.
BEWARE! handlers order is an important thing, and removing handlers or reordering handlers can have unexpected consequences.
Properties
ApplicationEventHandlers
Gets the IApplicationEventHandler implementations.
Declaration
public IEnumerable<IApplicationEventHandler> ApplicationEventHandlers { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IApplicationEventHandler> |
FilterCollection
Gets or sets a delegate to filter the event handler list (EXPERT!).
Declaration
public Action<IList<IApplicationEventHandler>> FilterCollection { get; set; }
Property Value
Type | Description |
---|---|
System.Action<System.Collections.Generic.IList<IApplicationEventHandler>> |
Remarks
This can be set on startup in the pre-boot process in either a custom boot manager or global.asax (UmbracoApplication).
Allows custom logic to execute in order to filter and/or re-order the event handlers prior to executing.
To be used by custom boot sequences where the boot loader needs to remove some handlers, or raise their priority.
Filtering the event handler collection can have ugly consequences. Use with care.
InstanceTypes
Override in order to only return types of IApplicationEventHandler and above, do not include the legacy types of IApplicationStartupHandler
Declaration
protected override IEnumerable<Type> InstanceTypes { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Type> |
IsDisposed
Gets a value indicating whether this instance is disposed.
Declaration
public bool IsDisposed { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
SupportsClear
Declaration
protected override bool SupportsClear { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
SupportsInsert
Declaration
protected override bool SupportsInsert { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
Finalize()
Declaration
protected void Finalize()
GetObjectWeight(Object)
Declaration
protected override int GetObjectWeight(object o)
Parameters
Type | Name | Description |
---|---|---|
System.Object | o |
Returns
Type | Description |
---|---|
System.Int32 |
InstantiateLegacyStartupHandlers()
Create instances of all of the legacy startup handlers
Declaration
public void InstantiateLegacyStartupHandlers()