C# Класс PetShop.Business.Validation.ValidationRules

Показать файл Открыть проект

Private Properties

Свойство Тип Описание
GetPropertyRules List
ValidateRuleList void
ValidationRules System

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

Метод Описание
AddRule ( ValidationRuleHandler handler, ValidationRuleArgs args ) : void

Adds a rule to the list of validated rules.

A rule is implemented by a method which conforms to the method signature defined by the ValidationRuleHandler delegate.

AddRule ( ValidationRuleHandler handler, string propertyName ) : void

Adds a rule to the list of validated rules.

A rule is implemented by a method which conforms to the method signature defined by the ValidationRuleHandler delegate.

Clear ( ) : void

Clear the rules list.

GetBrokenRules ( ) : BrokenRulesList

Return a BrokenRulesList that contains all of the invalid rules.

ValidateRules ( ) : void

Validate all the rules for all properties.

ValidateRules ( string propertyName ) : void

Validates all rules for a property

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

Метод Описание
GetPropertyRules ( string propertyName ) : List

Returns a list of ValidationRuleInfo objects for a specified property.

ValidateRuleList ( List ruleList ) : void

Validates a list of rules.

This method calls the Invoke method on each rule in the list. If the rule fails, it is added to the BrokenRulesList

ValidationRules ( object businessEntity ) : System

Creates an instance of the class and associates the target.

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

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

Adds a rule to the list of validated rules.

A rule is implemented by a method which conforms to the method signature defined by the ValidationRuleHandler delegate.

public AddRule ( ValidationRuleHandler handler, ValidationRuleArgs args ) : void
handler ValidationRuleHandler The method that implements the rule.
args ValidationRuleArgs /// A object specifying the property name and other arguments /// passed to the rule method ///
Результат void

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

Adds a rule to the list of validated rules.

A rule is implemented by a method which conforms to the method signature defined by the ValidationRuleHandler delegate.

public AddRule ( ValidationRuleHandler handler, string propertyName ) : void
handler ValidationRuleHandler The method that implements the rule.
propertyName string /// The name of the property on the target object where the rule implementation can retrieve /// the value to be validated. ///
Результат void

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

Clear the rules list.
public Clear ( ) : void
Результат void

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

Return a BrokenRulesList that contains all of the invalid rules.
public GetBrokenRules ( ) : BrokenRulesList
Результат BrokenRulesList

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

Validate all the rules for all properties.
public ValidateRules ( ) : void
Результат void

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

Validates all rules for a property
public ValidateRules ( string propertyName ) : void
propertyName string Name of the property to validate.
Результат void