Table of Contents

Class ValidationRuleBuilder

Namespace
EncDotNet.S100.Validation
Assembly
EncDotNet.S100.Core.dll

Fluent entry point for authoring IValidationRule<TModel> instances. Intended for the common case of a single property-style rule — Tier-1 schema rules and most Tier-2 spec-semantic rules. More complex rules (multi-finding emitters, Tier-3 cross-dataset rules) should implement IValidationRule<TModel> directly.

public static class ValidationRuleBuilder
Inheritance
ValidationRuleBuilder
Inherited Members

Examples

var rule = ValidationRuleBuilder.RuleFor<S421RoutePlan>("S421-R-3.1")
    .WithDescription("A route must contain at least two waypoints.")
    .WithSeverity(ValidationSeverity.Error)
    .Check(plan => plan.Route.Waypoints.Length >= 2,
           failureMessage: "Route contains fewer than two waypoints.")
    .Build();

Methods

RuleFor<TModel>(string)

Starts a fluent definition of a rule with the given identifier.

public static ValidationRuleBuilder.IRuleBuilder<TModel> RuleFor<TModel>(string ruleId)

Parameters

ruleId string

Stable rule identifier (e.g. "S421-R-3.1").

Returns

ValidationRuleBuilder.IRuleBuilder<TModel>

Type Parameters

TModel

The data-model type the rule operates on.