Misc

← Back Events guide

Events let use listen to database changes, like changing the field or entity, adding or removing entities. Make sure

  1. To pair adding a listener with removing a listener to prevent memory leaks
  2. 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

← Back to Misc