Merge pull request #249 from pcc/xgetinputfocus
[mono.git] / mcs / class / System.Web.Mvc3 / Mvc / StringLengthAttributeAdapter.cs
1 namespace System.Web.Mvc {
2     using System.Collections.Generic;
3     using System.ComponentModel.DataAnnotations;
4
5     public class StringLengthAttributeAdapter : DataAnnotationsModelValidator<StringLengthAttribute> {
6         public StringLengthAttributeAdapter(ModelMetadata metadata, ControllerContext context, StringLengthAttribute attribute)
7             : base(metadata, context, attribute) {
8         }
9
10         public override IEnumerable<ModelClientValidationRule> GetClientValidationRules() {
11             return new[] { new ModelClientValidationStringLengthRule(ErrorMessage, Attribute.MinimumLength, Attribute.MaximumLength) };
12         }
13     }
14 }