Adf.Base.Validation.MaxDataLengthAttribute.IsValid C# (CSharp) Method

IsValid() public method

Determines whether the specified value is valid for the supplied property.
public IsValid ( PropertyInfo propertyToValidate, object value ) : ValidationResult
propertyToValidate System.Reflection.PropertyInfo The supplied property.
value object The supplied value.
return ValidationResult
        public ValidationResult IsValid(PropertyInfo propertyToValidate, object value)
        {
            if (value == null || string.IsNullOrEmpty(value.ToString())) return ValidationResult.Success;

            return !HasMaxDataLength(value, precision, scale)
                 ? ValidationResult.CreateError(propertyToValidate, "Adf.Business.AttributeMaxDataLengthInvalid", propertyToValidate.Name, precision, scale)
                 : ValidationResult.Success;
        }