Example #1
0
        private void loadRemainingHistoryEvents(Guid id, IEventProvider <TDomainEvent> aggregateRoot)
        {
            var events = _domainEventStorage.GetEventsSinceLastSnapShot(id);

            if (events.Count() > 0)
            {
                aggregateRoot.LoadFromHistory(events);
                return;
            }

            aggregateRoot.LoadFromHistory(_domainEventStorage.GetAllEvents(id));
        }
        private void LoadRemainingHistoryEvents(Guid id, IEventProvider <TDomainEvent> aggregateRoot)
        {
            var events       = _domainEventStorage.GetEventsSinceLastSnapShot(id, aggregateRoot.GetType());
            var domainEvents = events as TDomainEvent[] ?? events.ToArray();

            if (domainEvents.Any())
            {
                aggregateRoot.LoadFromHistory(domainEvents);
                return;
            }

            aggregateRoot.LoadFromHistory(_domainEventStorage.GetAllEvents(id));
        }