Search code examples
enterprise-libraryvalidation-application-bl

Validation Application block - custom validator - message template


I am using Enterprise Library 4.1 Validation Application Block. I have created a custom validator and overridden the DefaultMessageTemplate property. My DoValidate method logic is as below

LogValidationResult(validationResults, String.Format(DefaultMessageTemplate, currentTarget, key), currentTarget, key)

However, when I specify a custom MessageTemplate for this validator in the Configuration tool, only the DefaultMessageTemplate text is displayed. How do I override the default message with a custom message for custom validators?

I would appreciate any help.

Thanks!


Solution

  • I managed to resolve this issue - it was because of incorrect constructors on the custom validator.

    Thanks!