Esempio n. 1
0
        public async Task <IEnumerable <IEvent> > Process <TCommand>(TCommand command)
            where TCommand : class, ICommand
        {
            Argument.IsNotNull(command, nameof(command));

            string     aggregateId = command.GetAggregateId();
            TAggregate aggregate   = await _aggregateRepository.LoadById(aggregateId);

            aggregate.Perform(command);

            await _aggregateRepository.Save(aggregate);

            return(aggregate.Changes);
        }