Show / Hide Table of Contents

Class RuleBuilder<TRule>

A builder which is used to define & configure a single instance of a validation rule.

Inheritance
System.Object
RuleBuilder<TRule>
Implements
IConfiguresRule<TRule>
IConfiguresContext
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.ValidatorBuilding
Assembly: CSF.Validation.dll
Syntax
public class RuleBuilder<TRule> : IConfiguresRule<TRule>, IConfiguresContext
Type Parameters
Name Description
TRule

The concrete type of the configured validation rule.

Constructors

| Improve this Doc View Source

RuleBuilder(IGetsManifestRuleIdentifierFromRelativeIdentifier, IGetsManifestRuleIdentifier)

Initialises an instance of RuleBuilder<TRule>.

Declaration
public RuleBuilder(IGetsManifestRuleIdentifierFromRelativeIdentifier relativeToManifestIdentityConverter, IGetsManifestRuleIdentifier identifierFactory)
Parameters
Type Name Description
IGetsManifestRuleIdentifierFromRelativeIdentifier relativeToManifestIdentityConverter

A service which converts relative rule identifiers to absolute ones.

IGetsManifestRuleIdentifier identifierFactory

A factory which creates manifest identifiers.

Properties

| Improve this Doc View Source

Dependencies

Gets or sets a collection of the relative identifiers of other validation rules upon which the current rule depends.

Declaration
public ICollection<RelativeRuleIdentifier> Dependencies { get; set; }
Property Value
Type Description
System.Collections.Generic.ICollection<RelativeRuleIdentifier>
Remarks

Validation rule dependencies work in two ways:

  • The current rule will not be executed until all of its dependencies have been executed.
  • If any of the current rule's dependencies does not complete with a Passed outcome then the current rule's execution will be skipped and automatically recorded as having a DependencyFailed outcome.

In case it is not obvious, specifying a circular set of validation rule dependencies is not allowed.

| Improve this Doc View Source

Name

Gets or sets an optional rule name. This may be used to differentiate different instances of the same rule (but with different configuration), applied to the same member or validated object.

Declaration
public string Name { get; set; }
Property Value
Type Description
System.String

Methods

| Improve this Doc View Source

ConfigureContext(ValidatorBuilderContext)

Performs configuration upon the context.

Declaration
public void ConfigureContext(ValidatorBuilderContext context)
Parameters
Type Name Description
ValidatorBuilderContext context

The builder context to configure.

| Improve this Doc View Source

ConfigureRule(Action<TRule>)

Specifies an action to be executed in order to configure the rule before it is executed.

Declaration
public void ConfigureRule(Action<TRule> ruleConfig)
Parameters
Type Name Description
System.Action<TRule> ruleConfig

The rule configuration action.

Implements

IConfiguresRule<TRule>
IConfiguresContext
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX