コード例 #1
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;
        }
コード例 #2
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;
        }
コード例 #3
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);
                    }
                }
            }
        }
コード例 #4
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);
                    }
                }
            }
        }
コード例 #5
0
 public void Register(IAggregateRegistration registration)
 {
     this.registrations.Add(registration);
 }