Events let use listen to database changes, like changing the field or entity, adding or removing entities. Make sure
- To pair adding a listener with removing a listener to prevent memory leaks
- all events handlers have try/catch block to prevent exception being fired from event handlers
Following events are available:
Event | Description |
---|---|
Field value changed | It is fired when provided field value change (any entity) |
Entity is updated | It is fired when provided entity value change (any field) |
Entity is deleted | It is fired when provided entity deleted |
Any entity is updated | It is fired when any entity updated (any field) |
Any entity is added | It is fired when new entity is added |
Any entity is deleted | It is fired when any entity deleted |
Before any entity deleted | It is fired before any entity is deleted |
Batch update event | Batch update event is fired when BGRepo.I.Events.Batch(Action action); method is used. When this method is used, no individual events will be fired while action is being executed, and one single batch event will be fired when action is executed. This is required for performance's sake when massive changes to database should be done without firing individual events |
Any change event | It is fired on any database change |
For usage example, see this demo C# script