C# Class System.ComponentModel.DataAnnotations.ValidationException

Inheritance: Exception
Show file Open project: dotnet/corefx Class Usage Examples

Public Methods

Method Description
ValidationException ( ) : System.Runtime.Serialization

Default constructor.

The long form of this constructor is preferred because it gives better error reporting.

ValidationException ( System.ComponentModel.DataAnnotations.ValidationResult validationResult, System.ComponentModel.DataAnnotations.ValidationAttribute validatingAttribute, object value ) : System.Runtime.Serialization

Constructor that accepts a structured ValidationResult describing the problem.

ValidationException ( string message ) : System.Runtime.Serialization

Constructor that accepts only a localized message

The long form of this constructor is preferred because it gives better error reporting.

ValidationException ( string message, Exception innerException ) : System.Runtime.Serialization

Constructor that accepts a localized message and an inner exception

The long form of this constructor is preferred because it gives better error reporting

ValidationException ( string errorMessage, System.ComponentModel.DataAnnotations.ValidationAttribute validatingAttribute, object value ) : System.Runtime.Serialization

Constructor that accepts an error message, the failing attribute, and the invalid value.

Protected Methods

Method Description
ValidationException ( SerializationInfo info, StreamingContext context ) : System.Runtime.Serialization

Constructor that takes a SerializationInfo.

Method Details

ValidationException() public method

Default constructor.
The long form of this constructor is preferred because it gives better error reporting.
public ValidationException ( ) : System.Runtime.Serialization
return System.Runtime.Serialization

ValidationException() protected method

Constructor that takes a SerializationInfo.
protected ValidationException ( SerializationInfo info, StreamingContext context ) : System.Runtime.Serialization
info System.Runtime.Serialization.SerializationInfo The SerializationInfo.
context System.Runtime.Serialization.StreamingContext The StreamingContext.
return System.Runtime.Serialization

ValidationException() public method

Constructor that accepts a structured ValidationResult describing the problem.
public ValidationException ( System.ComponentModel.DataAnnotations.ValidationResult validationResult, System.ComponentModel.DataAnnotations.ValidationAttribute validatingAttribute, object value ) : System.Runtime.Serialization
validationResult System.ComponentModel.DataAnnotations.ValidationResult The value describing the validation error
validatingAttribute System.ComponentModel.DataAnnotations.ValidationAttribute The attribute that triggered this exception
value object The value that caused the validating attribute to trigger the exception
return System.Runtime.Serialization

ValidationException() public method

Constructor that accepts only a localized message
The long form of this constructor is preferred because it gives better error reporting.
public ValidationException ( string message ) : System.Runtime.Serialization
message string The localized message
return System.Runtime.Serialization

ValidationException() public method

Constructor that accepts a localized message and an inner exception
The long form of this constructor is preferred because it gives better error reporting
public ValidationException ( string message, Exception innerException ) : System.Runtime.Serialization
message string The localized error message
innerException Exception inner exception
return System.Runtime.Serialization

ValidationException() public method

Constructor that accepts an error message, the failing attribute, and the invalid value.
public ValidationException ( string errorMessage, System.ComponentModel.DataAnnotations.ValidationAttribute validatingAttribute, object value ) : System.Runtime.Serialization
errorMessage string The localized error message
validatingAttribute System.ComponentModel.DataAnnotations.ValidationAttribute The attribute that triggered this exception
value object The value that caused the validating attribute to trigger the exception
return System.Runtime.Serialization