Interface IValidationLogic
A generalised/non-generic interface for executing validation logic and getting the results. It is not expected that developers would want to implement this interface for their own rules.
Inherited Members
Namespace: CSF.Validation.Rules
Assembly: CSF.Validation.Abstractions.dll
Syntax
public interface IValidationLogic : IHasRuleTimeoutRemarks
Instead of implementing this interface in order to create custom rules, developers should instead implement one of IRule<TValidated> or IRule<TValue, TParent> in their own logic.
The validation framework comes with implementations of this interface which serve as adapters/wrappers for those two interfaces noted above, allowing this interface to be used as a generalised mechanism for executing rule logic, regardless of the precise interface to which that logic were originally written.
Properties
| Improve this Doc View SourceRuleInterface
Gets the type of rule interface that is used by this rule logic.
Declaration
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>.
RuleObject
Gets a reference to the original/raw rule object instance.
Declaration
object RuleObject { get; }Property Value
| Type | Description | 
|---|---|
| System.Object | 
Methods
| Improve this Doc View SourceGetResultAsync(Object, Object, RuleContext, CancellationToken)
Executes the logic of the validation rule and returns the result.
Declaration
ValueTask<RuleResult> GetResultAsync(object value, object parentValue, RuleContext context, CancellationToken token = default(CancellationToken))Parameters
| Type | Name | Description | 
|---|---|---|
| System.Object | value | The value which is being validated by the current rule. | 
| System.Object | parentValue | An optional 'parent value' to the value being validated by the current rule.  This is
typically the object from which the  | 
| RuleContext | context | A validation rule context object. | 
| System.Threading.CancellationToken | token | An optional cancellation token to abort the validation process early. | 
Returns
| Type | Description | 
|---|---|
| System.Threading.Tasks.ValueTask<RuleResult> | A task which provides the rule result. |