Class ValidationContext
provides a way to manipulate the validation failures of the current endpoint context.
call Instance to obtain an instance of the current validation context.
Inheritance
ValidationContext
Assembly: FastEndpoints.dll
Syntax
public class ValidationContext
Properties
Instance
Declaration
public static ValidationContext Instance { get; }
Property Value
ValidationFailed
Declaration
public bool ValidationFailed { get; }
Property Value
ValidationFailures
Declaration
public List<ValidationFailure> ValidationFailures { get; }
Property Value
Type |
Description |
List<ValidationFailure> |
|
Methods
AddError(ValidationFailure)
Declaration
public void AddError(ValidationFailure failure)
Parameters
Type |
Name |
Description |
ValidationFailure |
failure |
|
AddError(string, string?, Severity)
Declaration
public void AddError(string message, string? errorCode = null, Severity severity = Severity.Error)
Parameters
Type |
Name |
Description |
string |
message |
|
string |
errorCode |
|
Severity |
severity |
|
ThrowError(ValidationFailure, int?)
Declaration
public void ThrowError(ValidationFailure failure, int? statusCode = null)
Parameters
Type |
Name |
Description |
ValidationFailure |
failure |
|
int? |
statusCode |
|
ThrowError(string, int?)
Declaration
public void ThrowError(string message, int? statusCode = null)
Parameters
Type |
Name |
Description |
string |
message |
|
int? |
statusCode |
|
ThrowIfAnyErrors(int?)
Declaration
public void ThrowIfAnyErrors(int? statusCode = null)
Parameters
Type |
Name |
Description |
int? |
statusCode |
|