Esempio n. 1
0
        public void Create(Guid id, string name)
        {
            if (Version > 0)
            {
                throw new InvalidOperationException("Cannot start a list more than once.");
            }
            AggregateId = id;
            var @event = new TodoListCreatedEvent(id, name);

            Publish(@event);
        }
Esempio n. 2
0
 public void When(TodoListCreatedEvent @event)
 {
     AggregateId = @event.Id;
     Name        = @event.Name;
     Tasks       = new List <TodoTask>();
 }