Skip to main content

AbstractComparisonValidator

Base class for all comparison validators

Assembly: ServiceStack.dll​
View Source​
Declaration
public abstract class AbstractComparisonValidator : PropertyValidator, IComparisonValidator, IPropertyValidator

Properties​

Comparison​

Metadata- the comparison type

View Source​
Declaration
public abstract Comparison Comparison { get; }

MemberToCompare​

Metadata- the member being compared

View Source​
Declaration
public MemberInfo MemberToCompare { get; }

ValueToCompare​

Metadata- the value being compared

View Source​
Declaration
public object ValueToCompare { get; }

Inherited Properties​

Options​

Additional options for configuring the property validator.

View Source​
Declaration
public PropertyValidatorOptions Options { get; }

Methods​

IsValid(PropertyValidatorContext)​

Performs the comparison

View Source​
Declaration
protected sealed override bool IsValid(PropertyValidatorContext context)
Returns​

System.Boolean

Parameters​
TypeName
ServiceStack.FluentValidation.Validators.PropertyValidatorContextcontext

IsValid(IComparable, IComparable)​

Override to perform the comparison

View Source​
Declaration
public abstract bool IsValid(IComparable value, IComparable valueToCompare)
Returns​

System.Boolean

Parameters​
TypeName
System.IComparablevalue
System.IComparablevalueToCompare

GetComparisonValue(PropertyValidatorContext)​

View Source​
Declaration
public IComparable GetComparisonValue(PropertyValidatorContext context)
Returns​

System.IComparable

Parameters​
TypeName
ServiceStack.FluentValidation.Validators.PropertyValidatorContextcontext

GetComparableValue(PropertyValidatorContext, Object)​

View Source​
Declaration
public IComparable GetComparableValue(PropertyValidatorContext context, object value)
Returns​

System.IComparable

Parameters​
TypeName
ServiceStack.FluentValidation.Validators.PropertyValidatorContextcontext
System.Objectvalue

Inherited Methods​

CreateValidationError(PropertyValidatorContext)​

Creates an error validation result for this validator.

View Source​
Declaration
protected virtual ValidationFailure CreateValidationError(PropertyValidatorContext context)
Returns​

ServiceStack.FluentValidation.Results.ValidationFailure: Returns an error validation result.

Parameters​
TypeNameDescription
ServiceStack.FluentValidation.Validators.PropertyValidatorContextcontextThe validator context

|

IsValid(PropertyValidatorContext)​

View Source​
Declaration
protected abstract bool IsValid(PropertyValidatorContext context)
Returns​

System.Boolean

Parameters​
TypeName
ServiceStack.FluentValidation.Validators.PropertyValidatorContextcontext

IsValidAsync(PropertyValidatorContext, CancellationToken)​

View Source​
Declaration
protected virtual async Task<bool> IsValidAsync(PropertyValidatorContext context, CancellationToken cancellation)
Returns​

System.Threading.Tasks.Task<System.Boolean>

Parameters​
TypeName
ServiceStack.FluentValidation.Validators.PropertyValidatorContextcontext
System.Threading.CancellationTokencancellation

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​
Declaration
protected string Localized(string fallbackKey)
Returns​

System.String: The translated error message template.

Parameters​
TypeNameDescription
System.StringfallbackKeyThe 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​
Declaration
protected virtual void PrepareMessageFormatterForValidationError(PropertyValidatorContext context)
Parameters​
TypeNameDescription
ServiceStack.FluentValidation.Validators.PropertyValidatorContextcontextThe validator context

|

ShouldValidateAsynchronously(IValidationContext)​

Determines whether this validator should be run asynchronously or not.

View Source​
Declaration
public virtual bool ShouldValidateAsynchronously(IValidationContext context)
Returns​

System.Boolean

Parameters​
TypeName
ServiceStack.FluentValidation.IValidationContextcontext

Validate(PropertyValidatorContext)​

Performs validation

View Source​
Declaration
public virtual IEnumerable<ValidationFailure> Validate(PropertyValidatorContext context)
Returns​

System.Collections.Generic.IEnumerable<ServiceStack.FluentValidation.Results.ValidationFailure>

Parameters​
TypeName
ServiceStack.FluentValidation.Validators.PropertyValidatorContextcontext

ValidateAsync(PropertyValidatorContext, CancellationToken)​

Performs validation asynchronously.

View Source​
Declaration
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​
TypeName
ServiceStack.FluentValidation.Validators.PropertyValidatorContextcontext
System.Threading.CancellationTokencancellation

Implements​