public override IEnumerable <ModelClientValidationRule> GetClientValidationRules( [NotNull] ClientModelValidationContext context) { var errorMessage = GetErrorMessage(context.ModelMetadata); var rule = new ModelClientValidationStringLengthRule(errorMessage, Attribute.MinimumLength, Attribute.MaximumLength); return(new[] { rule }); }
public override IEnumerable <ModelClientValidationRule> GetClientValidationRules( ClientModelValidationContext context) { if (context == null) { throw new ArgumentNullException(nameof(context)); } var errorMessage = GetErrorMessage(context); var rule = new ModelClientValidationStringLengthRule(errorMessage, Attribute.MinimumLength, Attribute.MaximumLength); return(new[] { rule }); }