linux-packaging-mono/mcs/class/referencesource/System.Web/ModelBinding/RegularExpressionAttributeAdapter.cs
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
837 B
C#

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