예제 #1
0
        public async Task <T> Get <T>(Guid aggregateId)
            where T : AggregateRoot
        {
            T aggregate;

            if (IsSnapshotable(typeof(T)))
            {
                aggregate = await _snapshotRepository.Get <T>(aggregateId);
            }
            else
            {
                aggregate = await _eventRepository.Get <T>(aggregateId);
            }


            if (aggregate.Removed)
            {
                throw new AggregateRemovedException(aggregate.Id);
            }

            return(aggregate);
        }