Interface IRuleExecutionContext
An object which provides context for the process of executing validation rules.
Namespace: CSF.Validation.RuleExecution
Assembly: CSF.Validation.Abstractions.dll
Syntax
public interface IRuleExecutionContext
Remarks
This object assists the validation process by tracking which rules have been executed and which have not. It also tracks the dependencies between rules, so that GetRulesWhichMayBeExecuted() will only return those which either have no dependencies or where all of their dependencies have already been executed.
Use HandleValidationRuleResult(ExecutableRule) after each rule completes (regardless of its outcome) in order to update this object so that it may return the appropriate result for future invocations of GetRulesWhichMayBeExecuted().
Properties
| Improve this Doc View SourceAllRules
Gets a read-only collection of all of the available validation rules and their dependencies.
Declaration
IEnumerable<ExecutableRuleAndDependencies> AllRules { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ExecutableRuleAndDependencies> |
Methods
| Improve this Doc View SourceGetRulesWhichMayBeExecuted()
Gets a collection of rules which are ready to be executed. Either they have no dependencies or their dependencies have executed and passed.
Declaration
IEnumerable<ExecutableRule> GetRulesWhichMayBeExecuted()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ExecutableRule> | A collection of rules that are ready to execute. |
GetRulesWhoseDependenciesHaveFailed()
Gets a collection of rules which should not be executed because their dependency rule(s) have failed.
Declaration
IEnumerable<ExecutableRule> GetRulesWhoseDependenciesHaveFailed()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ExecutableRule> | A collection of rules which have failed dependencies. |
HandleValidationRuleResult(ExecutableRule)
Handles the alteration of dependency chains and available rules based upon a single validation rule receiving a result.
Declaration
void HandleValidationRuleResult(ExecutableRule rule)
Parameters
Type | Name | Description |
---|---|---|
ExecutableRule | rule | The rule which now has a non-null Result property. |