コード例 #1
0
        public Person Take(EmailAddressCreateCommand command)
        {
            var mail = new EmailAddress(command);

            this.EmailAddresses.Add(mail);

            base.AddEvent(new PersonUpdatedDomainEvent
            {
                AggregateRootId = Id,
                CommandJson     = JsonConvert.SerializeObject(command),
                UserId          = command.UserId
            });

            return(this);
        }
コード例 #2
0
        public async Task <ICommandHandlerAggregateAnswer> HandleAsync(EmailAddressCreateCommand command)
        {
            var answer = new CommandHandlerAggregateAnswer();
            var person = await personRepository.Query(command.PersonId);

            if (person.IsNotNull())
            {
                answer.ValidationResult = this.createMailValidationHandler.Validate(command);

                if (command.IsValid)
                {
                    answer.AggregateRoot = await personRepository.Update(person.Take(command));
                }
            }
            return(answer);
        }
コード例 #3
0
 public EmailAddress(EmailAddressCreateCommand command)
 {
     this.CopyPropertiesFrom(command);
 }