protected override async Task <ValidationErrors> ValidatePut(
     Guid key,
     C value,
     IStringMap <Guid> keyMap,
     ValidationErrors errors)
 {
     return(errors
            .If(value.Name.StartsWith("X"), $"{nameof(value.Name)} can't start with 'X'."));
 }
Exemple #2
0
 protected override async Task <ValidationErrors> ValidatePut(
     TKey key,
     TValue value,
     IStringMap <TKey> keyMap,
     ValidationErrors errors)
 {
     return(errors
            .If(key.IsDefaultValue(),
                new ValidationError("Key must be provided.", true))
            .If(value.IsDefaultValue(),
                new ValidationError("Value must be provided.", true))
            .If(_getKeyFromEntity != null && keyMap.Map(key) != keyMap.Map(_getKeyFromEntity(value)),
                new ValidationError("Key does not match key in entity.", true)));
 }