/// <summary> /// Adds a new rule to the collection. /// </summary> /// <param name="isValid"></param> /// <param name="errorDelegate"></param> /// <param name="propertyNames">Names of the properties it affects.</param> public void Add(IsValidDelegateDefinition isValid, CustomErrorDelegateDefinition errorDelegate, params string[] propertyNames) { if (propertyNames == null) { throw new ArgumentNullException("propertyNames"); } foreach (string propertyName in propertyNames) { this.Add(isValid, errorDelegate, propertyName); } }
/// <summary> /// Adds a new rule to the collection. /// </summary> /// <param name="isValid"></param> /// <param name="errorDelegate"></param> /// <param name="propertyName"></param> public void Add(IsValidDelegateDefinition isValid, CustomErrorDelegateDefinition errorDelegate, string propertyName) { this.Add(new DelegateValidationRule(isValid, propertyName, errorDelegate)); }
/// <summary> /// Constructor for DelegateValidationRule. /// </summary> /// <param name="isValid">Validation delegate.</param> /// <param name="propertyName">Target property.</param> /// <param name="errorDelegate">Function creating the error message.</param> public DelegateValidationRule(IsValidDelegateDefinition isValid, string propertyName, CustomErrorDelegateDefinition errorDelegate) : base(isValid, "", propertyName) { ErrorDelegate = errorDelegate; }