Class RequiredIfBaseAttribute
This type supports the IRM infrastructure and is not intended to be used directly from your code.
Inherited Members
Namespace: IRM.ComponentModel.DataAnnotations
Assembly: IRM.dll
Syntax
public abstract class RequiredIfBaseAttribute : ValidationAttribute, _Attribute
Remarks
Implements base functionallity for all RequiredIf and AllowedIf attributes.
Constructors
RequiredIfBaseAttribute(String[])
Initializes a new instance of the RequiredIfBaseAttribute class.
Declaration
protected RequiredIfBaseAttribute(params string[] propertiesToCompare)
Parameters
String[]
propertiesToCompare
The name of one or more dependent properties. |
Properties
PropertiesToCompare
Gets the name of one or more dependent properties.
Declaration
public string[] PropertiesToCompare { get; }
Property Value
String[]
|
Methods
IsRequired(Object, ValidationContext)
Gets if a value is required or not.
Declaration
protected bool IsRequired(object value, ValidationContext validationContext)
Parameters
Object
value
The value to validate. |
System.ComponentModel.DataAnnotations.ValidationContext
validationContext
The context information about the validation operation. |
Returns
Boolean
true if the value is required; otherwise false. |
Remarks
Typically called by IsValid(Object, ValidationContext).
IsRequired(Object, ValidationContext, Object, PropertyInfo)
Gets if a value is required or not.
Declaration
protected abstract bool IsRequired(object value, ValidationContext validationContext, object propertyValue, PropertyInfo property)
Parameters
Object
value
The value to validate. |
System.ComponentModel.DataAnnotations.ValidationContext
validationContext
The context information about the validation operation. |
Object
propertyValue
The value of a |
PropertyInfo
property
The PropertyInfo for the current property to check. |
Returns
Boolean
true if the value is required; otherwise false. |
Remarks
This method is called once for each property in PropertiesToCompare.
IsValid(Object, ValidationContext)
Validates the specified value with respect to the current validation attribute.
Declaration
protected override ValidationResult IsValid(object value, ValidationContext validationContext)
Parameters
Object
value
The value to validate. |
System.ComponentModel.DataAnnotations.ValidationContext
validationContext
The context information about the validation operation. |
Returns
System.ComponentModel.DataAnnotations.ValidationResult
An instance of the System.ComponentModel.DataAnnotations.ValidationResult class. |