C# Class 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.
Inheritance: IPropRule
Datei anzeigen Open project: Chillisoft/habanero

Protected Properties

Property Type Description
_parameters object>.Dictionary

Public Methods

Method Description
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

Protected Methods

Method Description
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

Private Methods

Method Description
FillParameters ( IEnumerable availableParams, object>.Dictionary currentCollection ) : void

Method Details

GetBaseErrorMessage() protected method

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.
return string

IsPropValueValid() public method

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
return bool

PropRuleBase() protected method

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
return System

SetParameter() public method

Set a value for any named parameter
public SetParameter ( string parameterName, object value ) : void
parameterName string
value object
return void

SetupParameters() protected abstract method

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
return void

Property Details

_parameters protected_oe property

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
return object>.Dictionary