コード例 #1
0
        public void Handle(Command command)
        {
            _commandRepository.Add(command);
            _commandRepository.Commit();

            _validator.Validate(command);

            command.Execute();

            if (!_validator.HasValidations())
            {
                _eventBus.Dispatch();
                _uoW.Commit();
            }
        }
コード例 #2
0
        public override void Execute()
        {
            if (_centralValidations.HasValidations())
            {
                return;
            }

            var newUserEvent = new UserEvent(DomainEventType.Creation)
            {
                Id       = Guid.NewGuid(),
                Name     = Name,
                Login    = Login,
                Email    = Email,
                Password = Password
            };

            _eventBus.AddEvent(newUserEvent);
        }