Пример #1
0
        public async Task ValidateAsync(RegisterToEvent command)
        {
            var eventExists = await eventRepository.ExistsAsync(command.EventId);

            if (!eventExists)
            {
                throw EntityNotFound.Create <Event>(command.EventId);
            }
        }
        public Task <Result <EventBuffer <TId> > > LoadAsync(TId aggregateId)
        {
            var location = Location(aggregateId);

            if (!location.Exists)
            {
                return(Task.FromResult(Result.WithMessages <EventBuffer <TId> >(EntityNotFound.ForId(aggregateId))));
            }
            else
            {
                var buffer = EventBuffer <TId> .FromStorage(aggregateId, Load(location), e => e);

                return(Task.FromResult(Result.For(buffer)));
            }
        }