public void Include(IValidator <T> rulesToInclude) { if (rulesToInclude == null) { throw new ArgumentNullException("Cannot pass null to Include"); } var rule = IncludeRule.Create <T>(rulesToInclude, () => CascadeMode); NestedValidators.Add(rule); }
public IRuleBuilderInitial <T, TProperty> AddRule <TProperty>(Expression <Func <T, TProperty> > expression) { if (expression == null) { throw new ArgumentNullException("Cannot pass null to AddRule"); } var rule = PropertyRule.Create(expression, () => CascadeMode); NestedValidators.Add(rule); var ruleBuilder = new RuleBuilder <T, TProperty>(rule, this); return(ruleBuilder); }
public void ConfigDataAnnotation() { if (isConfigDataAnnotation == false) { isConfigDataAnnotation = true; if (dataAnnotationValidatiors == null) { dataAnnotationValidatiors = new TrackingCollection <IValidationRule>(); AddDataAnnotationValidation(); } foreach (var item in dataAnnotationValidatiors) { NestedValidators.Add(item); } } }