public virtual bool IsValid(string propertyName, ValidationType validation) { var mp = _m.GetProperty(propertyName); if (mp == null) { return(false); } var mpv = _m.Validations.Where(p => p.ValidationType == validation).FirstOrDefault(); if (mpv == null) { return(true); //if no such validation, continue } var bResult = false; switch (mpv.ValidationType) { case ValidationType.Required: bResult = ValidateRequired(propertyName); break; case ValidationType.Range: bResult = ValidateRange(propertyName, mpv); break; case ValidationType.StringLength: bResult = ValidateStringLength(propertyName, mpv); break; case ValidationType.RegularExpression: bResult = ValidateRegularExpression(propertyName, mpv); break; case ValidationType.Identifier: bResult = ValidateIdentifier(propertyName, mpv); break; case ValidationType.Email: bResult = ValidateEmail(propertyName, mpv); break; default: break; } return(bResult); }