// 同上,RemoveUsersCommand 的处理方法 public Task <Unit> Handle(RemoveUsersCommand message, CancellationToken cancellationToken) { if (!message.IsValid()) { NotifyValidationErrors(message); return(Task.FromResult(new Unit())); } _UsersRepository.Remove(message.Id); if (Commit()) { Bus.RaiseEvent(new UsersRemovedEvent(message.Id)); } return(Task.FromResult(new Unit())); }
public void Remove(Guid id) { var removeCommand = new RemoveUsersCommand(id); Bus.SendCommand(removeCommand); }