Events
Configuring event handlers in Konstrukt, the back office UI builder for Umbraco.
Konstrukt fires a number of notification events during regular operation to allow for extending of the default behaviour.
Registering event handlers
Konstrukt uses the same notification mechanism built into Umbraco v9 and so uses the same registration process. You first need to define a notification event handler for the event you wish to handle like so.
You then register your event handler in the ConfigureServices
method of your Startup.cs
file like so.
Repository events
KonstruktEntitySavingNotification
Raised when the repository Save
method is called and before the entity has been persisted. The notification contains an Entity
property with Before
and After
inner properties providing access to a copy of the currently persisted entity (or null if a new entity) and the updated entity about to be saved. Changes can be made to the After
entity and they will be persisted as part of the save operation. If the Cancel
property of the notification is set to true
then the save operation will be cancelled and no changes will be saved.
KonstruktEntitySavedNotification
Raised 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 providing access to a copy of the previously persisted entity (or null if a new entity) and the updated entity just saved.
KonstruktEntityDeletingNotification
Raised 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.
KonstruktEntityDeletedNotification
Raised 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 just deleted.
KonstruktSqlQueryBuildingNotification
Raised 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 that will be used to generate the SQL query.
KonstruktSqlQueryBuiltNotification
Raised 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.
Last updated