blob: 1861749734474daf2d5e993269d23e98e11b33c9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace System.Web.Mvc
{
public class RegularExpressionAttributeAdapter : DataAnnotationsModelValidator<RegularExpressionAttribute>
{
public RegularExpressionAttributeAdapter(ModelMetadata metadata, ControllerContext context, RegularExpressionAttribute attribute)
: base(metadata, context, attribute)
{
}
public override IEnumerable<ModelClientValidationRule> GetClientValidationRules()
{
return new[] { new ModelClientValidationRegexRule(ErrorMessage, Attribute.Pattern) };
}
}
}
|