コード例 #1
0
 public IEnumerable <ValidationMessage> Requires(AccountCommand command)
 {
     if (string.IsNullOrWhiteSpace(command.AccountId))
     {
         yield return(ValidationMessage.Error("Account id cannot be empty", nameof(command.AccountId)));
     }
 }
コード例 #2
0
 public IEnumerable <ValidationMessage> Requires(AccountCommand command, AccountState before)
 {
     if (command.AccountId != before.AccountId)
     {
         yield return(ValidationMessage.Error("This is not the right account", nameof(command.AccountId), nameof(before.AccountId)));
     }
 }