Manager / DataProvider EventsSitefinity CMS is implemented based on the provider pattern to offer an API that is easy to use and understand, and gives developers control over how the API works. All Manager implementations in Sitefinity CMS (and the respective DataProviders for these managers) expose events that you can subscribe to and plug additional logic.
EventHub events cover most use cases. We recommend working with the
EventHub API because of its simplicity. However, not all events can be exposed via
EventHub. In such cases, you use the
DataProvider but keep in mind that working with these events requires advanced knowledge of the system.
Executing and Executed events
The DataProvider / Manager events follow a standard naming convention:
- Executing events
You are subscribing to an event when data is not yet committed to the database. Thus, you can modify the data, perform validation, integrity check, and so on before passing the control back to Sitefinity.
- Executed events
You can plug in your logic right after Sitefinity commits the data to the database and is handling some post-commit tasks, for example, adjusting content relations. When hooking up to these events you usually want to control what happens to the data that is already persisted.
NOTE: These events fire more than once, depending on the CRUD operation you are performing. To identify whether someone is creating, updating, or deleting an item, you need to check for the item status in your implementation.