C# Class RequiredIfAttribute, code

Inheritance: ValidationAttribute, IClientValidatable
Afficher le fichier Open project: shendongnian/code Class Usage Examples

Méthodes publiques

Méthode Description
FormatErrorMessage ( string name ) : string

Applies formatting to an error message, based on the data field where the error occurred.

RequiredIfAttribute ( string otherProperty, object otherPropertyValue )

Initializes a new instance of the RequiredIfAttribute class.

Méthodes protégées

Méthode Description
IsValid ( object value, ValidationContext, validationContext ) : ValidationResult,

Validates the specified value with respect to the current validation attribute.

Method Details

FormatErrorMessage() public méthode

Applies formatting to an error message, based on the data field where the error occurred.
public FormatErrorMessage ( string name ) : string
name string The name to include in the formatted message.
Résultat string

IsValid() protected méthode

Validates the specified value with respect to the current validation attribute.
protected IsValid ( object value, ValidationContext, validationContext ) : ValidationResult,
value object The value to validate.
validationContext ValidationContext, The context information about the validation operation.
Résultat ValidationResult,

RequiredIfAttribute() public méthode

Initializes a new instance of the RequiredIfAttribute class.
public RequiredIfAttribute ( string otherProperty, object otherPropertyValue )
otherProperty string The other property.
otherPropertyValue object The other property value.