Example #1
0
 private void ValidateObjectKey(string input, ValidationContext <T> context)
 {
     if (!_validator.TryValidateObjectKey(input, _cfg.ObjectKeyValidationMode, out ValidationStatus status, out string?allowed))
     {
         context.AddFailure("Invalid object key: " + ValidationMessages.GetMessage(status, allowed));
     }
 }
Example #2
0
    public static void ValidateObjectKey(this IInputValidator validator, string?objectKey, ObjectKeyValidationMode mode)
    {
        if (validator.TryValidateObjectKey(objectKey, mode, out ValidationStatus status, out string?message))
        {
            return;
        }

        throw new ArgumentException("Invalid object key: " + ValidationMessages.GetMessage(status, message), nameof(objectKey));
    }