Xamarin Public Jenkins (auto-signing) 94b2861243 Imported Upstream version 4.8.0.309
Former-commit-id: 5f9c6ae75f295e057a7d2971f3a6df4656fa8850
2016-11-10 13:04:39 +00:00

20 lines
898 B
C#

namespace System.Web.ModelBinding {
using System.ComponentModel.DataAnnotations;
public sealed class StringLengthAttributeAdapter : DataAnnotationsModelValidator<StringLengthAttribute> {
public StringLengthAttributeAdapter(ModelMetadata metadata, ModelBindingExecutionContext context, StringLengthAttribute attribute)
: base(metadata, context, attribute) {
}
protected override string GetLocalizedErrorMessage(string errorMessage) {
return GetLocalizedString(errorMessage, Metadata.GetDisplayName(), Attribute.MinimumLength, Attribute.MaximumLength);
}
#if UNDEF
public override IEnumerable<ModelClientValidationRule> GetClientValidationRules() {
return new[] { new ModelClientValidationStringLengthRule(ErrorMessage, Attribute.MinimumLength, Attribute.MaximumLength) };
}
#endif
}
}