To add a validation rule to an entity object, use the Validation page of the Entity Object Editor, as shown in Figure 6-17. To add an attribute-level validation rule, select the attribute in the Declared Validation Rules tree, and click New.... Defining an entity-level validation rule is similar, except that you select the root entity object node in the tree before clicking New....
When you add a new validation rule, the Add Validation Rule dialog appears. Use the Rule dropdown list to select the kind of validation rule you want, and configure its declarative settings using the other controls in the page. The controls will change depending on the kind of validation rule you select. Figure 6-18 illustrates what the Add Validation Rule dialog would look like when defining a range validation rule for the
ProdId
attribute of the ServiceRequest
entity object. This validation rule has been selected to enforce that the value lie between 100
and 999
inclusive. When you add a validation rule, you also can enter an error
message that will be shown to the user if the validation rule fails.