94b2861243
Former-commit-id: 5f9c6ae75f295e057a7d2971f3a6df4656fa8850
20 lines
837 B
C#
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
|
|
}
|
|
}
|