コード例 #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));
        }
コード例 #2
0
ファイル: EventStore.cs プロジェクト: jackyzhou/ZSharp
        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);
        }
コード例 #3
0
 public async Task <TSnapshot> GetSnapshot <TSnapshot>(Guid snapshotId) where TSnapshot : IProjection
 {
     return(await _repository.GetSnapshot <TSnapshot>(snapshotId));
 }