Table of Contents

Class RuleBuilderOptionsExtensions

Namespace
Cratis.Applications.Validation
Assembly
Cratis.Applications.dll

Extensions for working with FluentValidation.IRuleBuilderOptions<T, TProperty>.

public static class RuleBuilderOptionsExtensions
Inheritance
RuleBuilderOptionsExtensions
Inherited Members

Methods

WhenCommand<T, TProperty>(IRuleBuilderOptions<T, TProperty>, ApplyConditionTo)

Specifies a condition for when the context is a command.

public static IRuleBuilderOptions<T, TProperty> WhenCommand<T, TProperty>(this IRuleBuilderOptions<T, TProperty> rule, ApplyConditionTo applyConditionTo = ApplyConditionTo.AllValidators)

Parameters

rule IRuleBuilderOptions<T, TProperty>

The current rule.

applyConditionTo ApplyConditionTo

Whether the condition should be applied to the current rule or all rules in the chain. Default: All.

Returns

IRuleBuilderOptions<T, TProperty>

An IRuleBuilder instance on which validators can be defined.

Type Parameters

T

Type of object being validated.

TProperty

Property type.

WhenQuery<T, TProperty>(IRuleBuilderOptions<T, TProperty>, ApplyConditionTo)

Specifies a condition for when the context is a query.

public static IRuleBuilderOptions<T, TProperty> WhenQuery<T, TProperty>(this IRuleBuilderOptions<T, TProperty> rule, ApplyConditionTo applyConditionTo = ApplyConditionTo.AllValidators)

Parameters

rule IRuleBuilderOptions<T, TProperty>

The current rule.

applyConditionTo ApplyConditionTo

Whether the condition should be applied to the current rule or all rules in the chain. Default: All.

Returns

IRuleBuilderOptions<T, TProperty>

An IRuleBuilder instance on which validators can be defined.

Type Parameters

T

Type of object being validated.

TProperty

Property type.