Self validating statements

Rated 4.75/5 based on 941 customer reviews

We can invoke only these rules by passing a rule Set parameter to the Validate extension method (note that this must be a named parameter as this overload has several options available).

Imagine you have two validators defined as part of a single rule definition, a Now, if the Not Null validator fails then the Not Equal validator will not be executed.

The default validation error messages contain the property name being validated.

For example, if you were to define a validator like this: that accepts a lambda expression in a similar way to With Name in the above example Property name resolution is also pluggable.

This means the above error message could be re-written as: …and the value ‘Surname’ will be inserted.

As specified in the example above, the message can contain placeholders for special values such as ‘’ - which will be replaced with a specified value.

Leave a Reply