예제 #1
0
        public void Execute(ICommandContext context, ChangeTodoCommand command)
        {
            var root = context.GetAggregateRoot <Guid, TodoAggregateRoot>(command.AggregateId);

            if (root == null)
            {
                return;
            }
            root.Change(command);
        }
예제 #2
0
        public void Change(ChangeTodoCommand command)
        {
            if (command.FinishTime < DateTime.Now)
            {
                throw new DomainException("结束时间不能早于当前时间");
            }

            ApplyChange(new TodoChangedEvent()
            {
                AggregateId = this.AggregateId,
                Name        = command.Name,
                Desception  = command.Desception,
                FinishTime  = command.FinishTime
            });
        }