Class ValidationRuleResult
Represents information about the result of running a single validation rule. Typically this is a class which implements either IRule<TValidated> or IRule<TValue, TParent>.
Inherited Members
Namespace: CSF.Validation
Assembly: CSF.Validation.Abstractions.dll
Syntax
public class ValidationRuleResult : RuleResult
Remarks
This class is a more complete version of RuleResult. Where the rule result only contains the information which would be directly output from the rule itself, this class provides more contextual information which may be 'backfilled' by the validation framework.
Constructors
| Improve this Doc View SourceValidationRuleResult(RuleResult, RuleContext, IValidationLogic, String, RuleInstrumentationData)
Initializes a new instance of the ValidationRuleResult class.
Declaration
public ValidationRuleResult(RuleResult result, RuleContext ruleContext, IValidationLogic validationLogic, string message = null, RuleInstrumentationData instrumentationData = null)
Parameters
Type | Name | Description |
---|---|---|
RuleResult | result | The rule result. |
RuleContext | ruleContext | The rule context. |
IValidationLogic | validationLogic | The validation logic for the rule. |
System.String | message | The human-readable validation feedback message. |
RuleInstrumentationData | instrumentationData | Optional instrumentation data. |
Remarks
This constructor copies-information-from and then enriches a RuleResult with further information.
Properties
| Improve this Doc View SourceIdentifier
Gets a unique identifier for the rule to which this result corresponds.
Declaration
public RuleIdentifier Identifier { get; }
Property Value
Type | Description |
---|---|
RuleIdentifier |
InstrumentationData
Gets optional instrumentation data about how the current rule executed.
Declaration
public RuleInstrumentationData InstrumentationData { get; }
Property Value
Type | Description |
---|---|
RuleInstrumentationData |
Remarks
This data is only collected and added to the validation rule result if InstrumentRuleExecution is set to true.
Message
Gets a human-readable feedback message to be associated with this rule result.
Declaration
public string Message { get; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
This property will always contain a null reference unless ResolvedValidationOptions are specified and the EnableMessageGeneration is set to true. If the options are not specified or message generation is not enabled, then generation of feedback messages is disabled/skipped.
RuleContext
Gets contextual information about this rule.
Declaration
public RuleContext RuleContext { get; }
Property Value
Type | Description |
---|---|
RuleContext |
RuleInterface
Gets a reference to the System.Type of rule interface which was used for this rule.
Declaration
public Type RuleInterface { get; }
Property Value
Type | Description |
---|---|
System.Type |
Remarks
This will be a closed-generic form of either IRule<TValidated> or IRule<TValue, TParent>.
ValidatedValue
Gets the actual value which was validated by this rule.
Declaration
public object ValidatedValue { get; }
Property Value
Type | Description |
---|---|
System.Object |
ValidationLogic
Gets a reference to the validation rule logic.
Declaration
public IValidationLogic ValidationLogic { get; }
Property Value
Type | Description |
---|---|
IValidationLogic |
Methods
| Improve this Doc View SourceToString()
Gets a string representation of the current instance.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | A string representation of the current object. |