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 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)); }
public virtual string GetErrorMessage(string propertyName, ValidationType validation) { var mp = _m.GetProperty(propertyName); if (mp == null) { return(string.Empty); } var mpv = new ObjectDefPropertyValidation(); // mp.GetValidation(validation); if (mpv == null) { return(string.Empty); } return(mpv.ValidationMessage); }
public static void MapReaderObjectDefPropertyValidation(SqlDataReader rdr, ObjectDefPropertyValidation obj) { MapReader <ObjectDefPropertyValidation>(rdr, obj, DataOperation.Read); }