<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />

System.ComponentModel.DataAnnotations.ValidationException

Represents the exception that occurs during validation of a data field when the ValidationAttribute class is used.

Gets the instance of the ValidationAttribute class that triggered this exception.

Gets the ValidationResult instance that describes the validation error.

public object Value { get; }

Gets the value of the object that causes the ValidationAttribute class to trigger this exception.

public ValidationException(ValidationResult validationResult, ValidationAttribute validatingAttribute, object value)

Initializes a new instance of the ValidationException class by using a validation result, a validation attribute, and the value of the current exception.

public ValidationException(string errorMessage, ValidationAttribute validatingAttribute, object value)

Initializes a new instance of the ValidationException class using a specified error message, a validation attribute, and the value of the current exception.

Initializes a new instance of the ValidationException class using an error message generated by the system.

public ValidationException(string message)

Initializes a new instance of the ValidationException class using a specified error message.

public ValidationException(string message, Exception innerException)

Initializes a new instance of the ValidationException class using a specified error message and a collection of inner exception instances.

Initializes a new instance of the ValidationException class using serialized data.