C# Класс Habanero.BO.PropRuleBase

Provides a super-class for property rules that test the validity of a property value. If you would like to implement your own property rule checker, inherit from this class, override the IsPropValueValid method and add a constructor with the same arguments as this one and pass back these arguments to base(). In the class definitions, in the 'rule' element under the relevant 'property', specify the class and assembly of your newly implemented class.
Наследование: IPropRule
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
_parameters object>.Dictionary

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

Метод Описание
IsPropValueValid ( string displayName, Object propValue, string &errorMessage ) : bool

Indicates whether the property value is valid against the rules

SetParameter ( string parameterName, object value ) : void

Set a value for any named parameter

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

Метод Описание
GetBaseErrorMessage ( object propValue, string displayName ) : string

Returns the base error message that can be used by sub classes of PropRuleBase.

PropRuleBase ( string name, string message ) : System

Constructor to initialise a new property rule

SetupParameters ( ) : void

Sets up the parameters to the rule, that is the individual pairs of rule type and rule value that make up the composite rule

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

Метод Описание
FillParameters ( IEnumerable availableParams, object>.Dictionary currentCollection ) : void

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

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

Returns the base error message that can be used by sub classes of PropRuleBase.
protected GetBaseErrorMessage ( object propValue, string displayName ) : string
propValue object The value that has cuased the broken rule.
displayName string The display name of the property that the business rule is broken for.
Результат string

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

Indicates whether the property value is valid against the rules
public IsPropValueValid ( string displayName, Object propValue, string &errorMessage ) : bool
displayName string The property name being checked
propValue Object The value to check
errorMessage string A string to amend with an error /// message indicating why the value might have been invalid
Результат bool

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

Constructor to initialise a new property rule
protected PropRuleBase ( string name, string message ) : System
name string The name of the rule
message string This rule's failure message
Результат System

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

Set a value for any named parameter
public SetParameter ( string parameterName, object value ) : void
parameterName string
value object
Результат void

SetupParameters() защищенный абстрактный Метод

Sets up the parameters to the rule, that is the individual pairs of rule type and rule value that make up the composite rule
protected abstract SetupParameters ( ) : void
Результат void

Описание свойств

_parameters защищенное свойство

A dictionary of parameters that are used for the different PropRules that Inherit from PropRuleBase e.g. values of 'min' or 'max' for that particular rule.
protected Dictionary _parameters
Результат object>.Dictionary