Min Length Custom AbstractValidationAttribute and Implementing Castle.Components.Validator.IValidato
- by CRice
I see with the Castle validators I can use a length validation attribute.
[ValidateLength(6, 30, "some error message")]
public string SomeProperty { get; set; }
I am trying to find a MinLength only attribute is there a way to do this with the out of the box attributes?
So far my idea is implementing AbstractValidationAttribute
public class ValidateMinLengthAttribute : AbstractValidationAttribute
and making its Build method return a MinLengthValidator, then using ValidateMinLength on SomeProperty
public class MinLengthValidator : Castle.Components.Validator.IValidator
Does anyone have an example of a fully implemented IValidator or know where such documentation exists?? I am not sure what all the methods and properties are expecting.
Thanks