For Developers: Sitefinity CMS 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.

 

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?

Next article

Tutorials