AsyncValidatorBase
Defines a property validator that can be run asynchronously.
Assembly: ServiceStack.dll
View Source
public abstract class AsyncValidatorBase : PropertyValidator, IPropertyValidator
Inherited Properties
Options
Additional options for configuring the property validator.
View Source
public PropertyValidatorOptions Options { get; }
Methods
ShouldValidateAsynchronously(IValidationContext)
View Source
public override bool ShouldValidateAsynchronously(IValidationContext context)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.FluentValidation.IValidationContext | context |
IsValid(PropertyValidatorContext)
View Source
protected override bool IsValid(PropertyValidatorContext context)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.FluentValidation.Validators.PropertyValidatorContext | context |
IsValidAsync(PropertyValidatorContext, CancellationToken)
View Source
protected abstract override Task<bool> IsValidAsync(PropertyValidatorContext context, CancellationToken cancellation)
Returns
System.Threading.Tasks.Task<System.Boolean>
Parameters
Type | Name |
---|---|
ServiceStack.FluentValidation.Validators.PropertyValidatorContext | context |
System.Threading.CancellationToken | cancellation |
Inherited Methods
CreateValidationError(PropertyValidatorContext)
Creates an error validation result for this validator.
View Source
protected virtual ValidationFailure CreateValidationError(PropertyValidatorContext context)
Returns
ServiceStack.FluentValidation.Results.ValidationFailure: Returns an error validation result.
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.Validators.PropertyValidatorContext | context | The validator context |
|
IsValid(PropertyValidatorContext)
View Source
protected abstract bool IsValid(PropertyValidatorContext context)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.FluentValidation.Validators.PropertyValidatorContext | context |
IsValidAsync(PropertyValidatorContext, CancellationToken)
View Source
protected virtual async Task<bool> IsValidAsync(PropertyValidatorContext context, CancellationToken cancellation)
Returns
System.Threading.Tasks.Task<System.Boolean>
Parameters
Type | Name |
---|---|
ServiceStack.FluentValidation.Validators.PropertyValidatorContext | context |
System.Threading.CancellationToken | cancellation |
Localized(String)
Retrieves a localized string from the LanguageManager. If an ErrorCode is defined for this validator, the error code is used as the key. If no ErrorCode is defined (or the language manager doesn't have a translation for the error code) then the fallback key is used instead.
View Source
protected string Localized(string fallbackKey)
Returns
System.String
: The translated error message template.
Parameters
Type | Name | Description |
---|---|---|
System.String | fallbackKey | The fallback key to use for translation, if no ErrorCode is available. |
|
PrepareMessageFormatterForValidationError(PropertyValidatorContext)
Prepares the ServiceStack.FluentValidation.Internal.MessageFormatter of <code data-dev-comment-type="paramref" class="paramref">context</code> for an upcoming ServiceStack.FluentValidation.Results.ValidationFailure.
View Source
protected virtual void PrepareMessageFormatterForValidationError(PropertyValidatorContext context)
Parameters
Type | Name | Description |
---|---|---|
ServiceStack.FluentValidation.Validators.PropertyValidatorContext | context | The validator context |
|
ShouldValidateAsynchronously(IValidationContext)
Determines whether this validator should be run asynchronously or not.
View Source
public virtual bool ShouldValidateAsynchronously(IValidationContext context)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
ServiceStack.FluentValidation.IValidationContext | context |
Validate(PropertyValidatorContext)
Performs validation
View Source
public virtual IEnumerable<ValidationFailure> Validate(PropertyValidatorContext context)
Returns
System.Collections.Generic.IEnumerable<ServiceStack.FluentValidation.Results.ValidationFailure>
Parameters
Type | Name |
---|---|
ServiceStack.FluentValidation.Validators.PropertyValidatorContext | context |
ValidateAsync(PropertyValidatorContext, CancellationToken)
Performs validation asynchronously.
View Source
public virtual async Task<IEnumerable<ValidationFailure>> ValidateAsync(PropertyValidatorContext context, CancellationToken cancellation)
Returns
System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<ServiceStack.FluentValidation.Results.ValidationFailure>>
Parameters
Type | Name |
---|---|
ServiceStack.FluentValidation.Validators.PropertyValidatorContext | context |
System.Threading.CancellationToken | cancellation |