Esempio n. 1
0
        public static IEnumerable <HFile> EnumerateFiles(this ISnapshotRepository snapshotRepository, SnapshotLocation snapshotLocation, BlackList blackList = null)
        {
            Snapshot snapshot = snapshotRepository.GetSnapshot(snapshotLocation);

            return(snapshot == null
                ? Enumerable.Empty <HFile>()
                : snapshot.EnumerateFiles(snapshotLocation.InternalPath, blackList));
        }
Esempio n. 2
0
        public T Get(Guid id)
        {
            T eventSourced = this.CreateEventSourcedInstance();
            IEnumerable <IDomainEvent> domainEvents;

            if (this.snapshotRepo.HasSnapshot(id))
            {
                ISnapshot snapshot = snapshotRepo.GetSnapshot(id);
                eventSourced.LoadFromSnapshot(snapshot);
                var eventsAfterSnapshot = this.domainEventRepo.LoadEvents(id, snapshot.Version);
                domainEvents = eventsAfterSnapshot;
            }
            else
            {
                domainEvents = domainEventRepo.LoadEvents(id);
            }
            eventSourced.LoadFromHistory(domainEvents);

            return(eventSourced);
        }
Esempio n. 3
0
 public async Task <TSnapshot> GetSnapshot <TSnapshot>(Guid snapshotId) where TSnapshot : IProjection
 {
     return(await _repository.GetSnapshot <TSnapshot>(snapshotId));
 }