Issue with Custom Validator

Apr 15, 2010 at 10:35 AM


I have following issues with the Custom validator. In the example/documentation the method Validate(...) is overridden. However, the parameter list does not match with the current version that contains an additional parameter SpecificationContainer (issue: documentation is outdated). In the source code of the class Matches<T> the Validate(...) method is overridden correctly. However, the parameter specificationContainer is not used in the implementation.

I assume that the idea was to be able to specify the specificationContainer for the validation. As far as I can tell the default specification is used in any case. Am I correct?


kind regards,


Apr 16, 2010 at 2:21 AM

Thank you again for the outdated documentation around Custom Validators. I've updated the documentation to include the additional parameter. 

You are correct that the parameter is not used in that implementation, but is for some of the built in rules. I'd like to refactor this in the future because I think the process of creating custom validators could be much easier. 

The SpecificationContainer is the set of specifications given a ValidationContext. If you use a context, the ValidationCatalog will prefer those specifications while resolving which specification to use during validation. If you aren't using a ValidationContext, it will just contain all the specifications in the ValidationCatalog.