Class RuleBuilderOptionsExtensions
- Namespace
- Cratis.Arc.Validation
- Assembly
- Cratis.Arc.Core.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
ruleIRuleBuilderOptions<T, TProperty>The current rule.
applyConditionToApplyConditionToWhether 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
TType of object being validated.
TPropertyProperty 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
ruleIRuleBuilderOptions<T, TProperty>The current rule.
applyConditionToApplyConditionToWhether 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
TType of object being validated.
TPropertyProperty type.
WithSeverity<T, TProperty>(IRuleBuilderOptions<T, TProperty>, ValidationResultSeverity)
Sets the severity level for the validation rule.
public static IRuleBuilderOptions<T, TProperty> WithSeverity<T, TProperty>(this IRuleBuilderOptions<T, TProperty> rule, ValidationResultSeverity severity)
Parameters
ruleIRuleBuilderOptions<T, TProperty>The current rule.
severityValidationResultSeverityThe ValidationResultSeverity to set.
Returns
- IRuleBuilderOptions<T, TProperty>
An IRuleBuilder instance on which validators can be defined.
Type Parameters
TType of object being validated.
TPropertyProperty type.
WithState<T, TProperty>(IRuleBuilderOptions<T, TProperty>, object)
Sets custom state for the validation rule.
public static IRuleBuilderOptions<T, TProperty> WithState<T, TProperty>(this IRuleBuilderOptions<T, TProperty> rule, object state)
Parameters
ruleIRuleBuilderOptions<T, TProperty>The current rule.
stateobjectThe state object to associate with the validation result.
Returns
- IRuleBuilderOptions<T, TProperty>
An IRuleBuilder instance on which validators can be defined.
Type Parameters
TType of object being validated.
TPropertyProperty type.