Work with EventHub events

Each event, both its identity and the associated data, is represented by an interface that inherits the IEvent interface. For instance the IMediaContentDownloadedEvent represents the event that a media content item (e.g. image) has been downloaded by a user and also defines some properties that provide contextual information about the concrete event – which image, from which library, etc.

Subscribe for an event

To subscribe for a particular event, you call the Subscribe method of the event service and pass the event interface as a generic argument. You can either use the lambda expression syntax to directly pass the executable code, or provide a separate delegate that will be invoked.

Lambda expression


Unsubscribe from an event

In order to unsubscribe, you need an instance of the delegate you passed when you subscribed. You pass it as an argument to the Unsubscribe method of the event service and again use the event interface as a generic argument.

"Before" and "after" events

Events exposed by Sitefinity CMS conform to the popular .NET naming convention. Events that are fired before an action are prefixed with “-ing”, while events that fire after an action are sufixed with “-ed”. For example, The “UserCreating” event will fire before a user is created, while the “UserCreated” event will fire after the user has been created.

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?