/// <summary> /// Adds a Property based Condition to the rule. The Property is added to the Condition if not provided by the condition. /// </summary> /// <param name="condition">The condition that will be validated</param> /// <returns>A Property bsed ValidationRule</returns> public virtual IValidationRule <T, TPrp> AddCondition(IValidationCondition <T, TPrp> condition) { if (condition.Property == null) { condition.Property = _property; } ValidationConditions.Add(condition); return(this); }
/// <summary> /// Adds a Condition to the rule. If the condition needs a Property to be validated, the property has to be added to the condition. This will not be done automaticaly. /// </summary> /// <param name="condition">The condition that will be validated</param> /// <returns>A ValidationRule</returns> public virtual IValidationRule <T> AddCondition(IValidationCondition <T> condition) { ValidationConditions.Add(condition); return(this); }