I know this is a little old post, but I will give a better answer to the question.
The responder wants to use CustomValidationAttribute and pass the error message using the ErrorMessage property.
If you want your static method to use the error message that you provided when registering your property, you also return:
new ValidationResult(string.Empty) or ValidationResult("") or ValidationResult(null) .
CustomValidationAttribute overrides FormatErrorMessage its base class and performs a conditional check on string.IsNullOrEmpty .
source share