CommonRules: MinLength issue

CommonRules: MinLength issue

Old forum URL: forums.lhotka.net/forums/t/8920.aspx


k2so posted on Wednesday, May 12, 2010

Hi Rocky,

I found another issue, with MinLength rule, can you take a look into it?

In MinLength:

    protected override void Execute(RuleContext context)
    {
      var value = context.InputPropertyValues[PrimaryProperty];
      if (value != null && value.ToString().Length > Min)
        context.AddErrorResult(
          string.Format(Resources.StringMinLengthRule, PrimaryProperty.FriendlyName, Min));
    }

Should the line be value.ToString().Length < Min instead, otherwise it is not invalidating the length less than the minimum. Haven't checked MaxLength yet.

 

 

RockfordLhotka replied on Wednesday, May 12, 2010

Thanks, that's a bug.

Copyright (c) Marimer LLC