public static bool IsNotOfType(object value, bool throwError = false) { if (!value.ContainsType <TType>()) { return(true); } if (!throwError) { return(false); } var ruleType = typeof(TType).FullName; throw ExceptionFactory.ArgumentException("", ExceptionMessages.TypesIsNotOfTypeFailed.Inject(ruleType)); }
public ValidationException ThrowAll() { var exceptions = this.Where(predicate => !predicate.Validate()) .Select(error => ExceptionFactory .ArgumentException( m_rule.Target.Name, error.ErrorMessage, m_rule.Target .ExceptionData)); if (exceptions.IsEmpty()) { return(null); } return(ExceptionFactory.ValidationException(m_rule.Target.Name, "Validation of {0} Failed.".Inject(m_rule.Target.Name), exceptions, m_rule.Target.ExceptionData)); }