public class RuleSet :
Public Class RuleSet
Implements IEnumerable(Of IRule),
Validation is based on rules declared in business class code and in the Validation node of the Application Model. Internally, these rules are automatically collected in the RuleSet.RegisteredRules property of the Validator.RuleSet object. The rules are checked automatically when saving and deleting objects and when an Action with the appropriate validation context is executed. If you need to modify the default behavior, you can access an instance of the RuleSet class via the static Validator.RuleSet property and then call the RuleSet methods or subscribe to the RuleSet events.
The following example demonstrates how to trigger the validation against a specific object and context, and then handle the result.
Private Sub RuleSetExampleController_Activated(ByVal sender As Object, ByVal e As EventArgs)
Dim result As RuleSetValidationResult = Validator.RuleSet.ValidateTarget(View.ObjectSpace, View.CurrentObject, "MyContext")
If result.ValidationOutcome > ValidationOutcome.Information Then
CType(View.CurrentObject, Contact).Notes &= "[Validation Error] " & result.Results(0).ErrorMessage
Normally, you should not create instances of the RuleSet class manually, because if you validate a custom RuleSet, rules from the Validator.RuleSet will be ignored and the validation result may be invalid.