Show / Hide Table of Contents

Class RuleExecutionContext

An object which tracks which rules may be executed and which are still awaiting the execution of their dependencies. This may also be used to get a list of the rules which should not be executed because their dependencies failed.

Inheritance
System.Object
RuleExecutionContext
Implements
IRuleExecutionContext
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: CSF.Validation.RuleExecution
Assembly: CSF.Validation.dll
Syntax
public class RuleExecutionContext : IRuleExecutionContext
Remarks

Note that this is a stateful service, so it is not suitable to re-use instances outside of the context of a validation run. This object maintains and tracks the state of a validation operation throughout the context of that operation. For a new validation run, create a new instance of this service.

Constructors

| Improve this Doc View Source

RuleExecutionContext(IEnumerable<ExecutableRuleAndDependencies>)

Initialises a new instance of RuleExecutionContext.

Declaration
public RuleExecutionContext(IEnumerable<ExecutableRuleAndDependencies> allRules)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<ExecutableRuleAndDependencies> allRules

A collection of all of the rules which could be executed.

Exceptions
Type Condition
System.ArgumentNullException

If allRules is null.

Properties

| Improve this Doc View Source

AllRules

Gets a read-only collection of all of the available validation rules and their dependencies.

Declaration
public IEnumerable<ExecutableRuleAndDependencies> AllRules { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<ExecutableRuleAndDependencies>

Methods

| Improve this Doc View Source

GetRulesWhichMayBeExecuted()

Gets a collection of rules which are ready to be executed. Either they have no dependencies or their dependencies have executed and passed.

Declaration
public IEnumerable<ExecutableRule> GetRulesWhichMayBeExecuted()
Returns
Type Description
System.Collections.Generic.IEnumerable<ExecutableRule>

A collection of rules that are ready to execute.

| Improve this Doc View Source

GetRulesWhoseDependenciesHaveFailed()

Gets a collection of rules which should not be executed because their dependency rule(s) have failed.

Declaration
public IEnumerable<ExecutableRule> GetRulesWhoseDependenciesHaveFailed()
Returns
Type Description
System.Collections.Generic.IEnumerable<ExecutableRule>

A collection of rules which have failed dependencies.

| Improve this Doc View Source

HandleValidationRuleResult(ExecutableRule)

Handles the alteration of dependency chains and available rules based upon a single validation rule receiving a result.

Declaration
public void HandleValidationRuleResult(ExecutableRule rule)
Parameters
Type Name Description
ExecutableRule rule

The rule which now has a non-null Result property.

Implements

IRuleExecutionContext
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX