Class ExceptionHandlingRuleLogicDecorator
A decorator class for the IValidation
Inheritance
Inherited Members
Namespace: CSF.Validation.Rules
Assembly: CSF.Validation.dll
Syntax
public class ExceptionHandlingRuleLogicDecorator : IValidationLogic, IHasRuleTimeout
Constructors
| Improve this Doc View SourceExceptionHandlingRuleLogicDecorator(IValidationLogic)
Initialises an instance of Exception
Declaration
public ExceptionHandlingRuleLogicDecorator(IValidationLogic wrapped)
Parameters
Type | Name | Description |
---|---|---|
IValidation |
wrapped | The rule logic to be wrapped by the current instance. |
Properties
| Improve this Doc View SourceRuleInterface
Gets the type of rule interface that is used by this rule logic.
Declaration
public Type RuleInterface { get; }
Property Value
Type | Description |
---|---|
System. |
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
public object RuleObject { get; }
Property Value
Type | Description |
---|---|
System. |
Methods
| Improve this Doc View SourceGetResultAsync(Object, Object, RuleContext, CancellationToken)
Executes the logic of the validation rule and returns the result.
Declaration
public async ValueTask<RuleResult> GetResultAsync(object value, object parentValue, RuleContext context, CancellationToken token = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System. |
value | The value which is being validated by the current rule. |
System. |
parentValue | An optional 'parent value' to the value being validated by the current rule. This is
typically the object from which the |
Rule |
context | A validation rule context object. |
System. |
token | An optional cancellation token to abort the validation process early. |
Returns
Type | Description |
---|---|
System. |
A task which provides the rule result. |
GetTimeout()
Gets the timeout value for the current rule.
Declaration
public TimeSpan? GetTimeout()
Returns
Type | Description |
---|---|
System. |
A timespan indicating the timeout duration, or a null reference if no timeout is applicable. |
Remarks
If this method returns non-null & the execution of the rule takes longer than this timeout value then:
The rule will immediately return an error result. Additionally the CancellationToken passed to the rule will be cancelled, allowing the rule logic to terminate early.