Validation



Warewolf validation is carried out both on the server and client via the warewolf validation framework. At the most atomic level, validation is carried out by executing a Validation Rule that implements the IRuleBase interface. An example of a rule would be an IsValidSyntax rule that validates the syntax of user input.

Validation occurs as and when it is needed, as such; there is no standard project or location for the definition of validation rules.
There are currently two methods of composing rules.
  • The first is an aggregation called RuleSet. A RuleSet is a collection of rules in which all rules must evaluate to true. Give a RuleSet [A, B, C] the RuleSet will evaluate {A && B && C}.
  • The other mechanism, is a ComposableRule rule that provides a fluent composition of rules with both [and] and [or] semantics.
RuleSets are tailored towards re-use while composition tailored toward edge cases.

Studio validation

Studio validation is carried out on the design surface on the large view of each Activities. If a user inputs an error when defining variables or other validation errors occur, then validation is triggered and a message is delivered to the user. At this point the user is forced to fix validation errors before continuing.
Validation is defined, in the studio, by overriding the ValidateThis or ValidateCollection methods of the ActivityDesignerViewModel depending on whether they are Grid activities or Non-grid Activities.

Server Validation

Server validation is, in most cases, carried out when during <>. Activities in general perform validation during execution because of the dynamic nature of warewolf services. If a validation rule fails, then the service execution will in most cases, bubble up an error to the user. There are certain use cases for failing validation but allowing execution to continue, but these are discouraged.

¿Le resulta útil este artículo?