public ValidationResult IsValid(PropertyInfo propertyToValidate, object value)
{
if (value == null)
// return ValidationResult.CreateError(property, "Adf.Business.AttributeRegexNull", property.Name);
// this is not a NonEmpty attribute!
return ValidationResult.Success;
if (!Regex.IsMatch(value.ToString(), expression))
return ValidationResult.CreateError(propertyToValidate, "Adf.Business.AttributeRegexInvalid", propertyToValidate.Name);
return ValidationResult.Success;
}