public async Task Handle(RegisterSpeechCommandMessage command) { if (command == null) { throw new ArgumentNullApplicationException(nameof(command)); } var title = new Title(command.Title); var urlValue = new UrlValue(command.Url); var description = new Description(command.Description); var type = new SpeechType(command.Type); var speech = new Domain.SpeechAggregate.Speech(AggregateId.NewId(), title, urlValue, description, type); await _speechRepository.CreateAsync(speech); await _domainEventSubscriber.Subscribe(speech); }
public async Task Handle(RegisterSpeechCommandMessage command) { if (command == null) { throw new ApplicationArgumentNullException(nameof(command)); } var title = new Title(command.Title); var urlValue = new UrlValue(command.Url); var description = new Description(command.Description); var type = new SpeechType(command.Type); var speech = new Domain.SpeechAggregate.Speech(title, urlValue, description, type); await _speechRepository.CreateAsync(speech); _unitOfWork.Commit(); }