Event system

Sitefinity CMS provides rich extensibility and integration points via exposing default events that are fired at important stages during the system operation. These events can come from the built-in modules or the Sitefinity application runtime. Depending on your scenario, you can subscribe to an event to:

  • Manipulate data
  • Extend default logic (for example, authentication, and authorization flow)
  • Execute code prior to Sitefinity CMS loads the backend and frontend for users to work with (for instance, register types in the IoC container on startup)

In addition to the default events, Sitefinity CMS enables you to implement custom event subscription by plugging in to the implementation of DataProvider and Manager patterns in the system.

Events in Sitefinity CMS can be grouped in three categories:

  • EventHub events (Logic/Business level, wrapping the data layer)– this is the biggest collection of default events exposed in Sitefinity. EventHub is part of the Sitefinity EventService implementation, which provides a central, uniform, and simplified mechanism for publishing and subscribing to events. EventService is a variation of the classic publish/subscribe pattern. It covers a wide part of Sitefinity CMS API, System services, and Web services.

  • Bootsrapper events (Web level) – these events are exposed by Sitefinity during its bootstrapping process. Via these events, you can directly intervene during system startup, so that you can alter system behavior.

  • Manager/ DataProvider events (Data level) – these events are available for all Sitefinity modules that persist data in the database and offer a lower level entry point during manager/provider execution.

    NOTE: Subscribing to these events provides you with greater flexibility as you are intercepting the code on provider level. Keep in mind that this implies deeper knowledge of the system and advanced coding skills, as the API is more complex than EventHub. It requires you to work with the provider commands, content lifecycle, and the underlying ORM implementation.

IMPORTANT: All events, described in this section are synchronous. Be aware that in case you are executing long running code, this affects the performance of your Sitefinity CMS application. The reason is the system waits for your code to complete before resuming its code execution flow. If you want your code to run in parallel with the Sitefinity CMS operation, you can consider running it asynchronously, for example, via a scheduled task or a standard background task. For more information, see For developers: Scheduled tasks.

This section contains

Subscribe to Sitefinity CMS events
You subscribe to an event that is published by a Sitefinity CMS class to write custom logic and have the logic executed when the event is raised
EventHub Events
EventHub is a mechanism that lets you easily subscribe to events raised by the Sitefinity CMS modules and execute custom code when they are fired.
Bootstrapper Events
Bootstrapper class is responsible for Sitefinity CMS initialization. Its events enable you to execute logic prior to Sitefinity loading its UI
Manager / DataProvider Events
All Manager implementations in Sitefinity CMS expose events that you can subscribe to and plug additional logic.
System Flags
System Flags are an important mechanism allowing you to detect the state of Sitefinity CMS in your code and act accordingly.
Service hooks
Service hooks allow for easier integration of Sitefinity CMS with third party systems.
Want to learn more?
Enhance your Sitefinity skills by enrolling in free training sessions. Become Sitefinity certified through Progress Education Community to strengthen your professional credentials.
New to Sitefinity?