/// <summary> /// Creates and initializes the rule. /// </summary> /// <param name="target">Object reference containing the data to validate.</param> /// <param name="handler">The address of the method implementing <see cref="ValidationRuleHandler"/>.</param> /// <param name="args">A <see cref="ValidationRuleArgs"/> object.</param> public ValidationRuleInfo(object target, ValidationRuleHandler handler, ValidationRuleArgs args) { _target = target; _handler = handler; _args = args; _ruleName = _handler.Method.Name + "!" + _args.ToString(); }
/// <summary> /// Adds a rule to the list of validated rules. /// </summary> /// <remarks> /// <para> /// A rule is implemented by a method which conforms to the /// method signature defined by the <see cref="ValidationRuleHandler" /> delegate. /// </para> /// </remarks> /// <param name="handler">The method that implements the rule.</param> /// <param name="args"> /// A <see cref="ValidationRuleArgs"/> object specifying the property name and other arguments /// passed to the rule method /// </param> public void AddRule(ValidationRuleHandler handler, ValidationRuleArgs args) { // get the list of rules for the property List <ValidationRuleInfo> list = GetPropertyRules(args.PropertyName); // we have the list, add our new rule list.Add(new ValidationRuleInfo(_target, handler, args)); }
public ValidationRuleInfo(object target, ValidationRuleHandler handler, TiannuoPM.Entities.Validation.ValidationRuleArgs args) { this._ruleName = string.Empty; this._target = target; this._handler = handler; this._args = args; this._ruleName = this._handler.Method.Name + "!" + this._args.ToString(); }
/// <summary> /// Adds a rule to the list of validated rules. /// </summary> /// <remarks> /// <para> /// A rule is implemented by a method which conforms to the /// method signature defined by the <see cref="ValidationRuleHandler" /> delegate. /// </para> /// </remarks> /// <param name="handler">The method that implements the rule.</param> /// <param name="args"> /// A <see cref="ValidationRuleArgs"/> object specifying the property name and other arguments /// passed to the rule method /// </param> public void AddRule(ValidationRuleHandler handler, ValidationRuleArgs args) { // get the list of rules for the property List<ValidationRuleInfo> list = GetPropertyRules(args.PropertyName); // we have the list, add our new rule list.Add(new ValidationRuleInfo(_target, handler, args)); }
/// <summary> /// Adds a rule to the list of validated rules. /// </summary> /// <remarks> /// <para> /// A rule is implemented by a method which conforms to the /// method signature defined by the <see cref="ValidationRuleHandler" /> delegate. /// </para> /// </remarks> /// <param name="handler">The method that implements the rule.</param> /// <param name="propertyName"> /// The name of the property on the target object where the rule implementation can retrieve /// the value to be validated. /// </param> public void AddRule(ValidationRuleHandler handler, string propertyName) { AddRule(handler, new ValidationRuleArgs(propertyName)); }
/// <summary> /// Creates and initializes the rule. /// </summary> /// <param name="target">Object reference containing the data to validate.</param> /// <param name="handler">The address of the method implementing <see cref="ValidationRuleHandler"/>.</param> /// <param name="propertyName">The name of the property to which the rule applies.</param> public ValidationRuleInfo(object target, ValidationRuleHandler handler, string propertyName) :this(target, handler, new ValidationRuleArgs(propertyName)) { }
/// <summary> /// Creates and initializes the rule. /// </summary> /// <param name="target">Object reference containing the data to validate.</param> /// <param name="handler">The address of the method implementing <see cref="ValidationRuleHandler"/>.</param> /// <param name="propertyName">The name of the property to which the rule applies.</param> public ValidationRuleInfo(object target, ValidationRuleHandler handler, string propertyName) : this(target, handler, new ValidationRuleArgs(propertyName)) { }
public ValidationRuleInfo(object target, ValidationRuleHandler handler, string propertyName) : this(target, handler, new TiannuoPM.Entities.Validation.ValidationRuleArgs(propertyName)) { }
public void AddRule(ValidationRuleHandler handler, ValidationRuleArgs args) { this.GetPropertyRules(args.PropertyName).Add(new ValidationRuleInfo(this._target, handler, args)); }