Example #1
0
        public void RegisterEvent(ITransactionEvent e)
        {
            lock (this) {
                if (e == null)
                {
                    throw new ArgumentNullException("e");
                }

                //if (Transaction.ReadOnly())
                //	throw new InvalidOperationException("Transaction is read-only.");

                if (e is ObjectCreatedEvent)
                {
                    var createdEvent = (ObjectCreatedEvent)e;
                    RegisterObjectCreated(createdEvent.ObjectName);
                }
                else if (e is ObjectDroppedEvent)
                {
                    var droppedEvent = (ObjectDroppedEvent)e;
                    RegisterObjectDropped(droppedEvent.ObjectName);
                }

                if (e is ITableEvent)
                {
                    var tableEvent = (ITableEvent)e;
                    TouchTable(tableEvent.TableId);
                }

                events.Add(e);
            }
        }
        private void RegisterEvent(ITransactionEvent e)
        {
            lock (this) {
                if (e == null)
                {
                    throw new ArgumentNullException("e");
                }

                //if (Transaction.ReadOnly())
                //	throw new InvalidOperationException("Transaction is read-only.");

                if (e is ObjectCreatedEvent)
                {
                    var createdEvent = (ObjectCreatedEvent)e;
                    RegisterObjectCreated(createdEvent.ObjectName);
                }
                else if (e is ObjectDroppedEvent)
                {
                    var droppedEvent = (ObjectDroppedEvent)e;
                    RegisterObjectDropped(droppedEvent.ObjectName);
                }

                if (e is ITableEvent)
                {
                    var tableEvent = (ITableEvent)e;
                    TouchTable(tableEvent.TableId);
                }

                events.Add(e);

                var routers = Context.ResolveAllServices <IEventRouter>();
                foreach (var router in routers)
                {
                    if (router.CanRoute(e))
                    {
                        router.RouteEvent(e);
                    }
                }
            }
        }
        private void OnError(ITransactionEvent @event, Exception ex)
        {
            var message = string.Format("Error occured while processing operation #{0}.", @event.TransactionId);

            Logger.Error(message, ex);
        }
Example #4
0
        private void RegisterEvent(ITransactionEvent e)
        {
            lock (this) {
                if (e == null)
                    throw new ArgumentNullException("e");

                //if (Transaction.ReadOnly())
                //	throw new InvalidOperationException("Transaction is read-only.");

                if (e is ObjectCreatedEvent) {
                    var createdEvent = (ObjectCreatedEvent) e;
                    RegisterObjectCreated(createdEvent.ObjectName);
                } else if (e is ObjectDroppedEvent) {
                    var droppedEvent = (ObjectDroppedEvent) e;
                    RegisterObjectDropped(droppedEvent.ObjectName);
                }

                if (e is ITableEvent) {
                    var tableEvent = (ITableEvent) e;
                    TouchTable(tableEvent.TableId);
                }

                events.Add(e);

                var routers = Context.ResolveAllServices<IEventRouter>();
                foreach (var router in routers) {
                    if (router.CanRoute(e))
                        router.RouteEvent(e);
                }
            }
        }
Example #5
0
        public void RegisterEvent(ITransactionEvent e)
        {
            lock (this) {
                if (e == null)
                    throw new ArgumentNullException("e");

                //if (Transaction.ReadOnly())
                //	throw new InvalidOperationException("Transaction is read-only.");

                if (e is ObjectCreatedEvent) {
                    var createdEvent = (ObjectCreatedEvent) e;
                    RegisterObjectCreated(createdEvent.ObjectName);
                } else if (e is ObjectDroppedEvent) {
                    var droppedEvent = (ObjectDroppedEvent) e;
                    RegisterObjectDropped(droppedEvent.ObjectName);
                }

                if (e is ITableEvent) {
                    var tableEvent = (ITableEvent) e;
                    TouchTable(tableEvent.TableId);
                }

                events.Add(e);
            }
        }