Interface IConceptRuleBuilder<T, TValue>

Namespace
Cratis.Arc.Validation
Assembly
Cratis.Arc.Core.dll

Represents an FluentValidation.IRuleBuilderInitial<T, TProperty> for a property that is a ConceptAs<T>, adding concept-specific fluent methods on top of the ordinary FluentValidation rule builder surface.

public interface IConceptRuleBuilder<T, TValue> : IRuleBuilderInitial<T, TValue>, IRuleBuilder<T, TValue>

Type Parameters

T

Type of object being validated.

TValue

The primitive type wrapped by the concept.

Inherited Members
IRuleBuilder<T, TValue>.SetValidator(IPropertyValidator<T, TValue>)
IRuleBuilder<T, TValue>.SetAsyncValidator(IAsyncPropertyValidator<T, TValue>)
Extension Methods

Methods

IgnoreConceptRules()

Suppresses any cross-cutting ConceptValidator<T> (or other IDiscoverableValidator<T>) registered for this concept type, for this property on this model type only. A ConceptValidator<T> for the same concept type still runs normally for every other property, and on every other model, that carries it.

IRuleBuilderInitial<T, TValue> IgnoreConceptRules()

Returns

IRuleBuilderInitial<T, TValue>

The underlying FluentValidation.IRuleBuilderInitial<T, TProperty>, so the validator's own rules (NotEmpty, Must, MustAsync, ...) against the concept's unwrapped value can still be declared with the rest of FluentValidation's fluent surface.

Remarks

Call this directly off RuleFor(...), before any other rule, e.g. RuleFor(_ => _.Name).IgnoreConceptRules().NotEmpty(). It cannot be called after .NotEmpty() or similar: those FluentValidation extension methods return FluentValidation's own IRuleBuilderOptions, which does not carry this member.