private bool ValidateIdentifier(string propertyName, ObjectDefPropertyValidation mpv) { ValidationAttribute attr = new IdentifierAttribute(); ObjectDefInstanceValidationAttribute target = new ObjectDefInstanceValidationAttribute(attr, _mv); return(target.IsValid(propertyName)); }
private bool ValidateRegularExpression(string propertyName, ObjectDefPropertyValidation mpv) { ValidationAttribute attr = new RegularExpressionAttribute(mpv.Expression); ObjectDefInstanceValidationAttribute target = new ObjectDefInstanceValidationAttribute(attr, _mv); return(target.IsValid(propertyName)); }
private bool ValidateRange(string propertyName, ObjectDefPropertyValidation mpv) { ValidationAttribute attr = new RangeAttribute((double)mpv.MinValue, (double)mpv.MaxValue); ObjectDefInstanceValidationAttribute target = new ObjectDefInstanceValidationAttribute(attr, _mv); return(target.IsValid(propertyName)); }
private bool ValidateRequired(string propertyName) { ValidationAttribute attr = new RequiredAttribute(); ObjectDefInstanceValidationAttribute target = new ObjectDefInstanceValidationAttribute(attr, _mv); return(target.IsValid(propertyName)); }
private bool ValidateStringLength(string propertyName, ObjectDefPropertyValidation mpv) { int maxLength = -1; if (!int.TryParse(mpv.Expression, out maxLength)) { return(true); //if validator expression is wrong (misconfiguration), continue } ValidationAttribute attr = new StringLengthAttribute(maxLength); ObjectDefInstanceValidationAttribute target = new ObjectDefInstanceValidationAttribute(attr, _mv); return(target.IsValid(propertyName)); }