Events
Configuring event handlers in Umbraco UI Builder.
Last updated
Was this helpful?
Configuring event handlers in Umbraco UI Builder.
Last updated
Was this helpful?
Umbraco UI Builder triggers different notification events during operation, allowing customization of default behavior.
Umbraco UI Builder follows the for event registration.
Define a notification event handler for the target event:
Register the event handler in Program.cs
:
EntitySavingNotification()
Triggers when Save
is called before persisting the entity. The notification contains an Entity
property with Before
and After
values, providing access to the previous and updated entities. Modify the After
entity to persist changes. If the Cancel
property of the notification is set to true
then the save operation will be canceled and no changes will be saved.
EntitySavedNotification()
Triggers when the repository Save
method is called and after the entity has been persisted. The notification contains an Entity
property with Before
and After
inner properties. These properties provide access to a copy of the previously persisted entity (or null if a new entity) and the updated entity that´s saved.
EntityDeletingNotification()
Triggers when the repository Delete
method is called and before the entity is deleted. The notification contains an Entity
property providing access to a copy of the entity about to be deleted. If the Cancel
property of notification is set to true
then the delete operation will be cancelled and entity won't be deleted.
EntityDeletedNotification()
Triggers when the repository Delete
method is called and after the entity has been deleted. The notification contains an Entity
property providing access to a copy of the entity that´s deleted.
SqlQueryBuildingNotification()
Triggers when the repository is preparing a SQL query. The notification contains the collection alias + type, the NPoco Sql<ISqlContext>
object, and the where clause/order by clauses. These will be used to generate the SQL query.
SqlQueryBuiltNotification()
Triggers when the repository has repaired a SQL query. The notification contains the collection alias + type, the NPoco Sql<ISqlContext>
object and the where clause/order by clauses that was used to generate the SQL query.
From version 15.1.0
, complex server-side validation can be added to a collection using the CancelOperation
method of the notification.