Esempio n. 1
0
        //public void AddRule(AsyncRuleHandler handler, RuleSeverity severity, AsyncRuleArgs args)
        //{
        //  // get the list of rules for the primary property
        //  List<IRuleMethod> list = GetRulesForProperty(args.Properties[0].Name, true).GetList(false);

        //  // we have the list, add our new rule
        //  list.Add(new AsyncRuleMethod(handler, args, severity));
        //}

        public void AddRule(RuleHandler handler, RuleArgs args, int priority)
        {
            // get the list of rules for the property
            List <IRuleMethod> list = GetRulesForProperty(args.PropertyName, true).GetList(false);

            // we have the list, add our new rule
            list.Add(new RuleMethod(handler, args, priority));
        }
Esempio n. 2
0
 /// <summary>
 /// Creates and initializes the rule.
 /// </summary>
 /// <param name="handler">The address of the method implementing the rule.</param>
 /// <param name="args">A RuleArgs object.</param>
 public RuleMethod(RuleHandler handler, RuleArgs args)
 {
     _handler  = handler;
     _args     = args;
     _ruleName = string.Format(@"rule://{0}/{1}/{2}",
                               Uri.EscapeDataString(_handler.Method.DeclaringType.GetAssemplyQualifiedName(true)),
                               _handler.Method.Name,
                               _args.ToString());
 }
        /// <summary>
        /// Gets the property name from the RuleArgs
        /// object, using the friendly name if one
        /// is defined.
        /// </summary>
        /// <param name="e">Object from which to
        /// extract the name.</param>
        /// <returns>
        /// The friendly property name if it exists,
        /// otherwise the property name itself.
        /// </returns>
        public static string GetPropertyName(RuleArgs e)
        {
            string propName = null;

            if (string.IsNullOrEmpty(e.PropertyFriendlyName))
            {
                propName = e.PropertyName;
            }
            else
            {
                propName = e.PropertyFriendlyName;
            }
            return(propName);
        }
Esempio n. 4
0
 /// <summary>
 /// Creates and initializes the rule.
 /// </summary>
 /// <param name="handler">The address of the method implementing the rule.</param>
 /// <param name="args">A RuleArgs object.</param>
 /// <param name="priority">
 /// Priority for processing the rule (smaller numbers have higher priority, default=0).
 /// </param>
 public RuleMethod(RuleHandler handler, RuleArgs args, int priority)
     : this(handler, args)
 {
     _priority = priority;
 }