C# Class HandCoded.Validation.RuleSet

A RuleSet instance contains a collection of validation rules that can be tested against a XmlDocument in a single operation.
Inheritance: Validator
Afficher le fichier Open project: formicary/fpml-toolkit-csharp Class Usage Examples

Méthodes publiques

Méthode Description
Add ( Rule rule ) : void

Adds the indicated Rule instance to the RuleSet A Rule may be referenced by several RuleSet instances simultaneously.

If the Rule has the same name as a previously added one then it will replace it. This feature can be used to overwrite standard rules with customized ones.

Add ( RuleSet ruleSet ) : void

Adds the Rule instances that comprise another RuleSet to this one.

ForName ( string name ) : RuleSet

Returns a reference to the named RuleSet instance if it exists.

Remove ( Rule rule ) : Rule

Attempts to remove a given Rule from the collection held by the RuleSet.

Remove ( string name ) : Rule

Attempts to remove a Rule with the given name from the collection held by the RuleSet.

RuleSet ( string name ) : System

Constructs a named empty RuleSet.

Méthodes protégées

Méthode Description
Validate ( NodeIndex nodeIndex, ValidationErrorHandler errorHandler ) : bool

Determines if the XmlDocument instance indexed by the provided NodeIndex has business data content that passes a validation test. If errors are detected they will be reported through the ValidationErrorHandler delegate passed as an argument.

Note that test returns true if it does not fail, including circumstances when the test is inapplicable to the XmlDocument under examination.

Private Methods

Méthode Description
ParseRuleSets ( string uri ) : void

Parse the RuleSet definitions in the configuration file indicated by the URI.

RuleSet ( ) : System

Causes the RuleSet class to try and bootstrap the business rules from a configuration file.

Method Details

Add() public méthode

Adds the indicated Rule instance to the RuleSet A Rule may be referenced by several RuleSet instances simultaneously.

If the Rule has the same name as a previously added one then it will replace it. This feature can be used to overwrite standard rules with customized ones.

public Add ( Rule rule ) : void
rule Rule The to be added.
Résultat void

Add() public méthode

Adds the Rule instances that comprise another RuleSet to this one.
public Add ( RuleSet ruleSet ) : void
ruleSet RuleSet The RuleSet to be added.
Résultat void

ForName() public static méthode

Returns a reference to the named RuleSet instance if it exists.
public static ForName ( string name ) : RuleSet
name string The name of the required RuleSet.
Résultat RuleSet

Remove() public méthode

Attempts to remove a given Rule from the collection held by the RuleSet.
public Remove ( Rule rule ) : Rule
rule Rule The to be removed.
Résultat Rule

Remove() public méthode

Attempts to remove a Rule with the given name from the collection held by the RuleSet.
public Remove ( string name ) : Rule
name string The name of the to be removed.
Résultat Rule

RuleSet() public méthode

Constructs a named empty RuleSet.
public RuleSet ( string name ) : System
name string
Résultat System

Validate() protected méthode

Determines if the XmlDocument instance indexed by the provided NodeIndex has business data content that passes a validation test. If errors are detected they will be reported through the ValidationErrorHandler delegate passed as an argument.
Note that test returns true if it does not fail, including circumstances when the test is inapplicable to the XmlDocument under examination.
protected Validate ( NodeIndex nodeIndex, ValidationErrorHandler errorHandler ) : bool
nodeIndex HandCoded.Xml.NodeIndex The instance to examine.
errorHandler ValidationErrorHandler An delegate used to report /// validation failures.
Résultat bool