Skip to main content

DefaultValidatorExtensionsServiceStack

Assembly: ServiceStack.dll
View Source
Declaration
public static class DefaultValidatorExtensionsServiceStack

Methods

ValidateAndThrow<T>(IValidator<T>, T, ApplyTo)

Performs validation and then throws an exception if validation fails.

View Source
Declaration
public static void ValidateAndThrow<T>(this IValidator<T> validator, T instance, ApplyTo applyTo)
Parameters
TypeNameDescription
ServiceStack.FluentValidation.IValidator<T>validatorThe validator this method is extending.

| | <T> | instance | The instance of the type we are validating.

| | ServiceStack.ApplyTo | applyTo | The ruleset to validate against.

|

Type Parameters
  • T

ValidateAndThrowAsync<T>(IValidator<T>, T, ApplyTo, CancellationToken)

Performs validation asynchronously and then throws an exception if validation fails.

View Source
Declaration
public static async Task ValidateAndThrowAsync<T>(this IValidator<T> validator, T instance, ApplyTo applyTo, CancellationToken token = default(CancellationToken))
Returns

System.Threading.Tasks.Task

Parameters
TypeNameDescription
ServiceStack.FluentValidation.IValidator<T>validatorThe validator this method is extending.

| | <T> | instance | The instance of the type we are validating.

| | ServiceStack.ApplyTo | applyTo | Optional: a ruleset when need to validate against.

| | System.Threading.CancellationToken | token |

|

Type Parameters
  • T