Ejemplo n.º 1
0
        public UnitOfWorkEventBus(IDomainNotificationBus bus, Action onCommit) : this(bus)
        {
            if (bus == null)
                throw new ArgumentNullException("bus");

            this.onCommit = onCommit;
        }
        public ReadModelBuildingEventBus(IList<IReadModelBuilder> builders, IDomainNotificationBus bus)
            : base(bus)
        {
            if (builders == null)
                throw new ArgumentNullException("builders");

            this.builders = builders;
        }
Ejemplo n.º 3
0
        public UnitOfWorkEventBus(IDomainNotificationBus bus)
        {
            if (bus == null)
                throw new ArgumentNullException("bus");

            this.events = new List<IDomainNotification>();
            this.bus = bus;
        }
Ejemplo n.º 4
0
        public UnitOfWorkEventBus(IDomainNotificationBus bus, Action onCommit) : this(bus)
        {
            if (bus == null)
            {
                throw new ArgumentNullException("bus");
            }

            this.onCommit = onCommit;
        }
Ejemplo n.º 5
0
        public UnitOfWorkEventBus(IDomainNotificationBus bus)
        {
            if (bus == null)
            {
                throw new ArgumentNullException("bus");
            }

            this.events = new List <IDomainNotification>();
            this.bus    = bus;
        }
        public ReadModelBuildingEventBus(IList <IReadModelBuilder> builders, IDomainNotificationBus bus)
            : base(bus)
        {
            if (builders == null)
            {
                throw new ArgumentNullException("builders");
            }

            this.builders = builders;
        }
Ejemplo n.º 7
0
        public DomainCommandExecutor(IUnitOfWorkScope scope, IAggregateRegistration registration, IDomainNotificationBus eventBus)
        {
            if (eventBus == null)
                throw new ArgumentNullException("eventBus");
            if (registration == null)
                throw new ArgumentNullException("registration");
            if (scope == null)
                throw new ArgumentNullException("scope");

            this.scope = scope;
            this.registration = registration;
            this.eventBus = eventBus;
        }
Ejemplo n.º 8
0
        public DomainCommandExecutor(IUnitOfWorkScope scope, IAggregateRegistration registration, IDomainNotificationBus eventBus)
        {
            if (eventBus == null)
            {
                throw new ArgumentNullException("eventBus");
            }
            if (registration == null)
            {
                throw new ArgumentNullException("registration");
            }
            if (scope == null)
            {
                throw new ArgumentNullException("scope");
            }

            this.scope        = scope;
            this.registration = registration;
            this.eventBus     = eventBus;
        }
Ejemplo n.º 9
0
        private void ProcessWorkItem(IUnitOfWorkScope scope, IAggregateRegistration registration, IDomainNotificationBus bus, IReadModelWorkItem workItem)
        {
            var eventScope = this.context.BeginUnitOfWork();

            using (eventScope)
            {
                var events   = eventScope.GetRegisteredObject <IEventStore>().GetEventsAfterVersion(workItem.Identity, workItem.FromVersion - 1).ToList();
                var builders = registration.DelayedReadModels(scope);
                foreach (var builder in builders)
                {
                    if (workItem.FromVersion == 0)
                    {
                        builder.DeleteForAggregate(workItem.Identity);
                    }

                    // we need to get the events from the event store
                    var builderEvents = builder.Process(events);
                    foreach (var evt in builderEvents)
                    {
                        bus.Publish(evt);
                    }
                }
            }
        }
Ejemplo n.º 10
0
        private void ProcessWorkItem(IUnitOfWorkScope scope, IAggregateRegistration registration, IDomainNotificationBus bus, IReadModelWorkItem workItem)
        {
            var eventScope = this.context.BeginUnitOfWork();
            using (eventScope)
            {
                var events = eventScope.GetRegisteredObject<IEventStore>().GetEventsAfterVersion(workItem.Identity, workItem.FromVersion - 1).ToList();
                var builders = registration.DelayedReadModels(scope);
                foreach (var builder in builders)
                {
                    if (workItem.FromVersion == 0)
                    {
                        builder.DeleteForAggregate(workItem.Identity);
                    }

                    // we need to get the events from the event store
                    var builderEvents = builder.Process(events);
                    foreach (var evt in builderEvents)
                    {
                        bus.Publish(evt);
                    }
                }
            }
        }
Ejemplo n.º 11
0
 public UnitOfWorkEventBus(IDomainNotificationBus bus, Action <IDomainNotification> onPublish, Action onCommit) : this(bus)
 {
     this.onPublish = onPublish;
     this.onCommit  = onCommit;
 }
Ejemplo n.º 12
0
 protected DomainContextBase(IDomainNotificationBus eventBus)
 {
     this.registrations = new List <IAggregateRegistration>();
     this.EventBus      = eventBus;
 }
Ejemplo n.º 13
0
 public UnitOfWorkEventBus(IDomainNotificationBus bus, Action<IDomainNotification> onPublish, Action onCommit) : this(bus)
 {
     this.onPublish = onPublish;
     this.onCommit = onCommit;
 }