Class AllowedIfNotNull
Specifies that a field is only allowed if one or more of the dependent properties is not null.
Inherited Members
System.ComponentModel.DataAnnotations.ValidationAttribute.GetValidationResult(System.Object, System.ComponentModel.DataAnnotations.ValidationContext)
System.ComponentModel.DataAnnotations.ValidationAttribute.Validate(System.Object, System.String)
System.ComponentModel.DataAnnotations.ValidationAttribute.ErrorMessageString
System.ComponentModel.DataAnnotations.ValidationAttribute.RequiresValidationContext
System.ComponentModel.DataAnnotations.ValidationAttribute.ErrorMessage
System.ComponentModel.DataAnnotations.ValidationAttribute.ErrorMessageResourceName
System.ComponentModel.DataAnnotations.ValidationAttribute.ErrorMessageResourceType
System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo, System.Type)
System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo)
System.Attribute.GetCustomAttribute(System.Reflection.MemberInfo, System.Type)
System.Attribute.GetCustomAttribute(System.Reflection.MemberInfo, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo)
System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo, System.Type)
System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo, System.Boolean)
System.Attribute.IsDefined(System.Reflection.ParameterInfo, System.Type)
System.Attribute.IsDefined(System.Reflection.ParameterInfo, System.Type, System.Boolean)
System.Attribute.GetCustomAttribute(System.Reflection.ParameterInfo, System.Type)
System.Attribute.GetCustomAttribute(System.Reflection.ParameterInfo, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.Module, System.Type)
System.Attribute.GetCustomAttributes(System.Reflection.Module)
System.Attribute.GetCustomAttributes(System.Reflection.Module, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.Module, System.Type, System.Boolean)
System.Attribute.IsDefined(System.Reflection.Module, System.Type)
System.Attribute.IsDefined(System.Reflection.Module, System.Type, System.Boolean)
System.Attribute.GetCustomAttribute(System.Reflection.Module, System.Type)
System.Attribute.GetCustomAttributes(System.Reflection.Assembly, System.Type)
System.Attribute.GetCustomAttributes(System.Reflection.Assembly, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.Assembly, System.Boolean)
System.Attribute.IsDefined(System.Reflection.Assembly, System.Type)
System.Attribute.IsDefined(System.Reflection.Assembly, System.Type, System.Boolean)
System.Attribute.GetCustomAttribute(System.Reflection.Assembly, System.Type)
System.Attribute.Equals(System.Object)
System.Attribute.GetHashCode()
System.Attribute.Match(System.Object)
System.Attribute.IsDefaultAttribute()
System.Attribute.System.Runtime.InteropServices._Attribute.GetTypeInfoCount(System.UInt32)
System.Attribute.System.Runtime.InteropServices._Attribute.GetTypeInfo(System.UInt32, System.UInt32, System.IntPtr)
System.Attribute.System.Runtime.InteropServices._Attribute.GetIDsOfNames(System.Guid, System.IntPtr, System.UInt32, System.UInt32, System.IntPtr)
System.Attribute.System.Runtime.InteropServices._Attribute.Invoke(System.UInt32, System.Guid, System.UInt32, System.Int16, System.IntPtr, System.IntPtr, System.IntPtr, System.IntPtr)
System.Object.ToString()
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetType()
Namespace: IRM.ComponentModel.DataAnnotations
Assembly: IRM.dll
Syntax
public class AllowedIfNotNull : RequiredIfBaseAttribute, _Attribute
Constructors
AllowedIfNotNull(String[])
Initializes a new instance of the AllowedIfNotNull class.
Declaration
public AllowedIfNotNull(params string[] propertiesToCompare)
Parameters
String[]
propertiesToCompare
The name of one or more dependent properties. |
Methods
IsRequired(Object, ValidationContext, Object, PropertyInfo)
Gets if a value is required or not.
Declaration
protected override 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. |
Overrides
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. |