Inheritance: Deveel.Data.Diagnostics.Event
Esempio n. 1
0
        protected override void FireTrigger(TableEvent tableEvent, IBlock context)
        {
            var e = new TriggerEvent(TriggerType.Callback, TriggerInfo.TriggerName, tableEvent.Table.TableInfo.TableName, tableEvent.EventTime, tableEvent.EventType,
                tableEvent.OldRowId, tableEvent.NewRow);

            context.Context.RegisterEvent(e);
        }
 public void OnTriggerEvent(TriggerEvent trigger)
 {
     try {
         if (listener != null)
             listener(trigger);
     } catch (Exception ex) {
         // TODO: form a source...
         systemContext.EventRegistry.Error(null, ex);
     }
 }
Esempio n. 3
0
 protected override ISystemContext CreateSystemContext()
 {
     var context = base.CreateSystemContext();
     context.ListenTriggers(trigger => {
         if ((trigger.TriggerEventType & TriggerEventType.After) != 0) {
             afterEvent = trigger;
         } else if ((trigger.TriggerEventType & TriggerEventType.Before) != 0) {
             beforeEvent = trigger;
         }
     });
     return context;
 }
Esempio n. 4
0
        public static void FireTrigger(this IQueryContext context, TableEventContext tableEvent)
        {
            var eventSource = tableEvent.Table.FullName;
            var eventType = tableEvent.EventType;

            var triggers = context.Session.FindTriggers(eventSource, eventType);

            foreach (var trigger in triggers) {
                try {
                    trigger.Fire(tableEvent);

                    var oldRowId = tableEvent.OldRowId;
                    var newRow = tableEvent.NewRow;

                    var triggerEvent = new TriggerEvent(trigger.TriggerName, eventSource, eventType, oldRowId, newRow);

                    context.RegisterEvent(triggerEvent);
                } catch (Exception) {
                    // TODO: throw a specialized exception
                    throw;
                }
            }
        }
Esempio n. 5
0
        private void NotifyTriggerEvent(IQueryContext context, TableEventContext tableEvent)
        {
            var tableName = tableEvent.Table.FullName;
            var eventType = tableEvent.EventType;

            var triggerEvent = new TriggerEvent(context.Session, TriggerName, tableName, eventType, tableEvent.OldRowId,
                tableEvent.NewRow);
            context.RegisterEvent(triggerEvent);
        }