Пример #1
0
 public async Task Handle(AddLocal command)
 {
     IdValue.ValidateOrThrow(command.Id);
     LocalName.ValidateOrThrow(command.Name);
     try
     {
         await AppendEvent(command.Id, new LocalAdded(command.Id, command.Name), expectedVersion : 1, command.CommandId);
     }
     catch (EventStreamUnexpectedMaxEventIdException)
     {
         throw new DomainException($"Local with id {command.Id} already exists", ErrorCode.LocalAlreadyExists);
     }
 }
Пример #2
0
 public async Task Handle(RemoveLocalAlias command)
 {
     IdValue.ValidateOrThrow(command.LocalId);
     LocalName.ValidateOrThrow(command.Alias);
     await AppendEvent(command.LocalId, new LocalAliasRemoved(command.LocalId, command.Alias), commandId : command.CommandId);
 }
Пример #3
0
 public async Task Handle(RemoveLocal command)
 {
     IdValue.ValidateOrThrow(command.Id);
     await AppendEvent(command.Id, new LocalRemoved(command.Id), commandId : command.CommandId);
 }
Пример #4
0
 public async Task Handle(RenameLocal command)
 {
     IdValue.ValidateOrThrow(command.Id);
     LocalName.ValidateOrThrow(command.NewName);
     await AppendEvent(command.Id, new LocalRenamed(command.Id, command.NewName), commandId : command.CommandId);
 }