hejdig.
I created a slightly simpler example. (Since I got help from the original posting I thought help later readers.)
Also note that one has to add a rule for both Min and Max and that there will be two myEntity.BrokenRulesList items.
protected override void AddValidationRules()
{
base.AddValidationRules();
ValidationRules.AddRule(ValidateMinMax, "Min");
ValidationRules.AddRule(ValidateMinMax, "Max");
}
public bool ValidateMinMax( object o, Validation.ValidationRuleArgs e)
{
if (min < max)
{
return true;
}
else
{
e.Description = string.Format("Min [{0}] must be less than Max [{0}]", min, max);
return false;
}
}
/OF