IValidationRule
Defines a rule associated with a property which can have multiple validators.
Assembly: ServiceStack.dll
View Source
public interface IValidationRule
Properties
Validators
The validators that are grouped under this rule.
View Source
IEnumerable<IPropertyValidator> Validators { get; }
RuleSets
Name of the rule-set to which this rule belongs.
View Source
string[] RuleSets { get; set; }
Methods
Validate(IValidationContext)
Performs validation using a validation context and returns a collection of Validation Failures.
View Source
IEnumerable<ValidationFailure> Validate(IValidationContext context)
Returns
System.Collections.Generic.IEnumerable<ServiceStack.FluentValidation.Results.ValidationFailure>
: A collection of validation failures
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IValidationContext | context | Validation Context |
|
ValidateAsync(IValidationContext, CancellationToken)
Performs validation using a validation context and returns a collection of Validation Failures asynchronously.
View Source
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
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.IValidationContext | context | Validation 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
void ApplyCondition(Func<PropertyValidatorContext, bool> predicate, ApplyConditionTo applyConditionTo = ApplyConditionTo.AllValidators)
Parameters
Type | Name | Description |
---|---|---|
System.Func<ServiceStack.FluentValidation.Validators.PropertyValidatorContext,System.Boolean> | predicate | The 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
void ApplyAsyncCondition(Func<PropertyValidatorContext, CancellationToken, Task<bool>> predicate, ApplyConditionTo applyConditionTo = ApplyConditionTo.AllValidators)
Parameters
Type | Name | Description |
---|---|---|
System.Func<ServiceStack.FluentValidation.Validators.PropertyValidatorContext,System.Threading.CancellationToken,System.Threading.Tasks.Task<System.Boolean>> | predicate | The 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
void ApplySharedCondition(Func<IValidationContext, bool> condition)
Parameters
Type | Name | Description |
---|---|---|
System.Func<ServiceStack.FluentValidation.IValidationContext,System.Boolean> | condition | The condition to apply. |
|
ApplySharedAsyncCondition(Func<IValidationContext, CancellationToken, Task<Boolean>>)
Applies an asynchronous condition that wraps the entire rule.
View Source
void ApplySharedAsyncCondition(Func<IValidationContext, CancellationToken, Task<bool>> condition)
Parameters
Type | Name | Description |
---|---|---|
System.Func<ServiceStack.FluentValidation.IValidationContext,System.Threading.CancellationToken,System.Threading.Tasks.Task<System.Boolean>> | condition | The condition to apply. |
|