//It is complaining about the two lines below.
//I am pretty new to c# coding.
ValidationRules.AddRule<Member>(PasswordValidationRule<Member>, PasswordProperty);
ValidationRules.AddRule<Member>(PasswordVerifyValidationRule<Member>, PasswordProperty);
}
private static bool PasswordValidationRule<T>(T target, Validation.RuleArgs e) where T : Member
{
if (target.Password != target.PasswordVerify)
{
e.Description = "Passwords do not match.";
return false;
}
return true;
}
private static bool PasswordVerifyValidationRule<T>(Member target, Validation.RuleArgs e) where T : Member
{
if (target.Password != target.PasswordVerify)
{
e.Description = "Password and password verify do not match.";
return false;
}
return true;
}
Visual Studio is complaining here.
private
static bool PasswordValidationRule(T target, Validation.RuleArgs e) where T : Member
That doesn't work.
Can you show me an example?
No, your rule method was (I think) fine. It is the AddRules() call that's the problem.
ValidationRules.AddRule<ObjectType>(RuleMethod, PropertyInfo);
Don't put the generic type on the rule method name here.
SouthSpawn:Are you saying like this?private
static bool PasswordValidationRule(T target, Validation.RuleArgs e) where T : Member
That doesn't work.
Can you show me an example?
Copyright (c) Marimer LLC