Skip to main content

IValidationRule

Defines a rule associated with a property which can have multiple validators.

Assembly: ServiceStack.dll
View Source
Declaration
public interface IValidationRule

Properties

Validators

The validators that are grouped under this rule.

View Source
Declaration
IEnumerable<IPropertyValidator> Validators { get; }

RuleSets

Name of the rule-set to which this rule belongs.

View Source
Declaration
string[] RuleSets { get; set; }

Methods

Validate(IValidationContext)

Performs validation using a validation context and returns a collection of Validation Failures.

View Source
Declaration
IEnumerable<ValidationFailure> Validate(IValidationContext context)
Returns

System.Collections.Generic.IEnumerable<ServiceStack.FluentValidation.Results.ValidationFailure>: A collection of validation failures

Parameters
TypeNameDescription
ServiceStack.FluentValidation.IValidationContextcontextValidation Context

|

ValidateAsync(IValidationContext, CancellationToken)

Performs validation using a validation context and returns a collection of Validation Failures asynchronously.

View Source
Declaration
Task<IEnumerable<ValidationFailure>> ValidateAsync(IValidationContext context, CancellationToken cancellation)
Returns

System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<ServiceStack.FluentValidation.Results.ValidationFailure>>: A collection of validation failures

Parameters
TypeNameDescription
ServiceStack.FluentValidation.IValidationContextcontextValidation Context

| | System.Threading.CancellationToken | cancellation | Cancellation token

|

ApplyCondition(Func<PropertyValidatorContext, Boolean>, ApplyConditionTo)

Applies a condition to either all the validators in the rule, or the most recent validator in the rule chain.

View Source
Declaration
void ApplyCondition(Func<PropertyValidatorContext, bool> predicate, ApplyConditionTo applyConditionTo = ApplyConditionTo.AllValidators)
Parameters
TypeNameDescription
System.Func<ServiceStack.FluentValidation.Validators.PropertyValidatorContext,System.Boolean>predicateThe condition to apply

| | ServiceStack.FluentValidation.ApplyConditionTo | applyConditionTo | Indicates whether the condition should be applied to all validators in the rule, or only the current one

|

ApplyAsyncCondition(Func<PropertyValidatorContext, CancellationToken, Task<Boolean>>, ApplyConditionTo)

Applies an asynchronous condition to either all the validators in the rule, or the most recent validator in the rule chain.

View Source
Declaration
void ApplyAsyncCondition(Func<PropertyValidatorContext, CancellationToken, Task<bool>> predicate, ApplyConditionTo applyConditionTo = ApplyConditionTo.AllValidators)
Parameters
TypeNameDescription
System.Func<ServiceStack.FluentValidation.Validators.PropertyValidatorContext,System.Threading.CancellationToken,System.Threading.Tasks.Task<System.Boolean>>predicateThe condition to apply

| | ServiceStack.FluentValidation.ApplyConditionTo | applyConditionTo | Indicates whether the condition should be applied to all validators in the rule, or only the current one

|

ApplySharedCondition(Func<IValidationContext, Boolean>)

Applies a condition that wraps the entire rule.

View Source
Declaration
void ApplySharedCondition(Func<IValidationContext, bool> condition)
Parameters
TypeNameDescription
System.Func<ServiceStack.FluentValidation.IValidationContext,System.Boolean>conditionThe condition to apply.

|

ApplySharedAsyncCondition(Func<IValidationContext, CancellationToken, Task<Boolean>>)

Applies an asynchronous condition that wraps the entire rule.

View Source
Declaration
void ApplySharedAsyncCondition(Func<IValidationContext, CancellationToken, Task<bool>> condition)
Parameters
TypeNameDescription
System.Func<ServiceStack.FluentValidation.IValidationContext,System.Threading.CancellationToken,System.Threading.Tasks.Task<System.Boolean>>conditionThe condition to apply.

|