示例#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));
        }
 public CustomerRenamed(string aggregateId, string name, RenameCustomer previous)
     : base(typeof(Customer).Name, aggregateId, 0, previous)
 {
     Id   = aggregateId;
     Name = name;
 }