예제 #1
0
        public async Task Rename(RenameCustomer command)
        {
            if (command.AggregateId != Id)
            {
                throw new InvalidOperationException("The command was not sended to this aggregate root.");
            }

            await RaiseEventAsync(new CustomerRenamed(Id, command.Name, command));
        }
예제 #2
0
 public CustomerRenamed(string aggregateId, string name, RenameCustomer previous)
     : base(typeof(Customer).Name, aggregateId, 0, previous)
 {
     Id   = aggregateId;
     Name = name;
 }