예제 #1
0
        public void Handle(AddSubThing command)
        {
            MyThing t = _repo.GetAggregate(command.AggregateId);

            t.ApplyEvent(new MySubThingAdded(t.AggregateId, command.Subthing));
            _repo.SaveAggregate(t);
        }
예제 #2
0
        public void Handle(RemoveSubThing command)
        {
            MyThing t = _repo.GetAggregate(command.AggregateId);

            t.ApplyEvent(new SubThingRemoved(t.AggregateId, command.SubThingId));
            _repo.SaveAggregate(t);
        }
예제 #3
0
        public void Handle(UpdateMyThing command)
        {
            MyThing t = _repo.GetAggregate(command.Id);

            t.ApplyEvent(new MyThingUpdated(t.AggregateId, command.Title));
            _repo.SaveAggregate(t);
        }