public async Task <Maybe <TAggregate> > GetAsync(TId id) { if (id == null) { throw new ArgumentNullException(nameof(id)); } var stream = GetStream(id); var snapshot = await _snapshotStore.ReadSnapshotAsync <TAggregate, TId>(stream.Id); if (!snapshot.Any()) { return(await GetByEventsAsync(id, stream)); } return(await GetBySnapsotAsync(id, stream, snapshot.Single())); }
public Task <Maybe <IAggregateSnapshot> > ReadSnapshotAsync <T, TId>(StreamId stream) where T : IAggregate <TId> => _store.ReadSnapshotAsync <T, TId>(stream);