/// <summary> /// Mark property as required, creating a ValidationResult if this property has no value. /// Additional rules will only be evaluated if this rule is valid. /// </summary> /// <returns><see cref="WithRuleBuilder<T, TProperty>"/></returns> public WithRuleBuilder <T, TProperty> Required() { _propertyValidator.ConditionalAndRule(new Required <T, TProperty>()); //_propertyValidator.PropertyValueRequired = true; return(new WithRuleBuilder <T, TProperty>(_propertyValidator)); }
private ActionJoinBuilder <T, TProperty> AddRuleAndReturnActionJoin(RuleValidator specRule) { if (OrNextRule) { if (NextRuleIsConditional) { _propertyValidator.ConditionalOrRule(specRule); } else { _propertyValidator.OrRule(specRule); } } else { if (NextRuleIsConditional) { _propertyValidator.ConditionalAndRule(specRule); } else { _propertyValidator.AndRule(specRule); } } return(new ActionJoinBuilder <T, TProperty>(_propertyValidator)); }