C# Класс HandCoded.Validation.RuleSet

A RuleSet instance contains a collection of validation rules that can be tested against a XmlDocument in a single operation.
Наследование: Validator
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Защищенные методы

Метод Описание
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.

Приватные методы

Метод Описание
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.

Описание методов

Add() публичный Метод

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.
Результат void

Add() публичный Метод

Adds the Rule instances that comprise another RuleSet to this one.
public Add ( RuleSet ruleSet ) : void
ruleSet RuleSet The RuleSet to be added.
Результат void

ForName() публичный статический Метод

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.
Результат RuleSet

Remove() публичный Метод

Attempts to remove a given Rule from the collection held by the RuleSet.
public Remove ( Rule rule ) : Rule
rule Rule The to be removed.
Результат Rule

Remove() публичный Метод

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.
Результат Rule

RuleSet() публичный Метод

Constructs a named empty RuleSet.
public RuleSet ( string name ) : System
name string
Результат System

Validate() защищенный Метод

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.
Результат bool