This project is read-only.

Custom Rules

Sometimes what you need to validate isn't so clearly defined by the built-in rules. For these scenarios, you can create your own custom rule.

Method

Check(c => c.Name).Required().Expect(ValidName, "You entered an invalid name.");

private bool ValidName(Customer customer, string name)
{
    return name == "A valid name.";
}

Inline

Check(c => c.Name).Required().Expect((c, name) => name == "A valid name.", "You entered an invalid name.");

Last edited Feb 26, 2010 at 10:19 PM by TechnoAg, version 1

Comments

No comments yet.