C# Class ExoRule.Validation.PropertyRule

Abstract base for simple validation rules for properties in a model.
Inheritance: Rule, IPropertyRule
Mostrar archivo Open project: vc3/ExoRule

Private Properties

Property Type Description
PropertyRule System

Public Methods

Method Description
PropertyRule ( string rootType, string property, ConditionType conditionType, RuleInvocationType invocationTypes ) : System

Creates a new PropertyRule for the specified property and condition type.

PropertyRule ( string rootType, string property, ConditionType>.Func conditionType, RuleInvocationType invocationTypes ) : System

Creates a new PropertyRule for the specified property and condition type.

Protected Methods

Method Description
ConditionApplies ( ModelInstance root ) : bool

Overridden in subclasses to determine if the ConditionType applies.

Format ( ModelType rootType, string property, object value ) : string

Formats the specified value based on the formatting associated with the specified property.

GetErrorCode ( string rootType, string property, string rule ) : string

Generates a unique error code for a property-specific rule.

GetLabel ( ModelType rootType, string property ) : string

Gets the label for the specified property.

GetSourceLabel ( ModelType rootType, string source ) : string

Gets the label for the specified source property path.

InitializePredicates ( ) : void

Initializes predicates for the specified property rule which leverages a comparison property.

OnInvoke ( ModelInstance root, ModelEvent modelEvent ) : void
PropertyRule ( string rootType, string property, RuleInvocationType invocationTypes ) : System

Private Methods

Method Description
PropertyRule ( ) : System

Register resources for validation rule subclasses.

Method Details

ConditionApplies() protected abstract method

Overridden in subclasses to determine if the ConditionType applies.
protected abstract ConditionApplies ( ModelInstance root ) : bool
root ModelInstance
return bool

Format() protected static method

Formats the specified value based on the formatting associated with the specified property.
protected static Format ( ModelType rootType, string property, object value ) : string
rootType ModelType
property string
value object
return string

GetErrorCode() protected static method

Generates a unique error code for a property-specific rule.
protected static GetErrorCode ( string rootType, string property, string rule ) : string
rootType string
property string
rule string
return string

GetLabel() protected static method

Gets the label for the specified property.
protected static GetLabel ( ModelType rootType, string property ) : string
rootType ModelType
property string
return string

GetSourceLabel() protected static method

Gets the label for the specified source property path.
protected static GetSourceLabel ( ModelType rootType, string source ) : string
rootType ModelType
source string
return string

InitializePredicates() protected method

Initializes predicates for the specified property rule which leverages a comparison property.
protected InitializePredicates ( ) : void
return void

OnInvoke() protected method

protected OnInvoke ( ModelInstance root, ModelEvent modelEvent ) : void
root ModelInstance
modelEvent ExoModel.ModelEvent
return void

PropertyRule() public method

Creates a new PropertyRule for the specified property and condition type.
public PropertyRule ( string rootType, string property, ConditionType conditionType, RuleInvocationType invocationTypes ) : System
rootType string
property string
conditionType ConditionType
invocationTypes RuleInvocationType
return System

PropertyRule() public method

Creates a new PropertyRule for the specified property and condition type.
public PropertyRule ( string rootType, string property, ConditionType>.Func conditionType, RuleInvocationType invocationTypes ) : System
rootType string
property string
conditionType ConditionType>.Func
invocationTypes RuleInvocationType
return System

PropertyRule() protected method

protected PropertyRule ( string rootType, string property, RuleInvocationType invocationTypes ) : System
rootType string
property string
invocationTypes RuleInvocationType
return System