I use FluentValidation framework in my ASP.NET MVC 4 project for both server-side and client-side validation.
Is there native (non-hack) way to validate string length with only max length, or only min length?
For example this way:
var isMinLengthOnly = true;
var minLength = 10;
RuleFor(m => m.Name)
.NotEmpty().WithMessage("Name required")
.Length(minLength, isMinLengthOnly);
default error message template should be not
'Name' must be between 10 and 99999999 characters. You entered 251 characters.
but
'Name' must be longer than 10 characters. You entered 251 characters.
And client-side attributes should be supported, e.g. hacks like RuleFor(m => m.Name.Length).GreaterThanOrEqual(minLength)
(not sure if it works) not applicable.