Class RelativeRuleIdentifier
A model for information which may uniquely identity a validation rule, based upon the logical 'position' (within a validator) of another rule. In other words, it uniquely identifies a rule, based upon a current rule.
Inheritance
Inherited Members
Namespace: CSF.Validation.ValidatorBuilding
Assembly: CSF.Validation.Abstractions.dll
Syntax
public class RelativeRuleIdentifier
Constructors
| Improve this Doc View SourceRelativeRuleIdentifier(Type, String, String, Int32)
Initializes a new instance of RelativeRuleIdentifier.
Declaration
public RelativeRuleIdentifier(Type ruleType, string memberName = null, string ruleName = null, int ancestorLevels = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Type | ruleType | The rule type. |
System.String | memberName | An optional member name. |
System.String | ruleName | An optional rule name. |
System.Int32 | ancestorLevels | An optional number of ancestor levels. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | If |
System.ArgumentOutOfRangeException | If |
Properties
| Improve this Doc View SourceAncestorLevels
Gets the number of levels of ancestry (within the parent/child validation hierarchy) which must be traversed from the 'current' rule, in order to reach the validator which contains the identified rule.
Declaration
public int AncestorLevels { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
MemberName
Where the referenced rule is for a member of a value/object, this property gets the member name.
Declaration
public string MemberName { get; }
Property Value
Type | Description |
---|---|
System.String |
RuleName
An optional rule name, to uniquely identify this rule where other identifying information might be ambiguous.
Declaration
public string RuleName { get; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
Any rule may have a name, whether it needs one or not. Rules only require a name when the other identifying information would not uniquely identify the rule. That being:
- The rule type: RuleType
- The object identifier (where applicable)
- The member name which provides the value being validated (where applicable)
In these cases where the three pieces of information above are insufficient to uniquely identify a rule, then the rule must be named in order for its identity to be unambiguous. This is most common when the same rule type is applied more than once to the same validated value (but each time with different configuration).
RuleType
The type of the validation rule logic class.
Declaration
public Type RuleType { get; }
Property Value
Type | Description |
---|---|
System.Type |