Skip to main content

StringEnumValidator

Assembly: ServiceStack.dll​
View Source​
Declaration
public class StringEnumValidator : PropertyValidator, IPropertyValidator

Inherited Properties​

Options​

Additional options for configuring the property validator.

View Source​
Declaration
public PropertyValidatorOptions Options { get; }

Methods​

IsValid(PropertyValidatorContext)​

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

System.Boolean

Parameters​
TypeName
ServiceStack.FluentValidation.Validators.PropertyValidatorContextcontext

GetDefaultMessageTemplate()​

View Source​
Declaration
protected override string GetDefaultMessageTemplate()
Returns​

System.String

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​