Example #1
0
        /// <summary>
        /// 采用指定匹配模式添加Conditions项。
        /// </summary>
        /// <param name="matchMode">Conditions匹配方式。</param>
        /// <param name="name">Condition名称。</param>
        /// <param name="value">Condition数值。</param>
        public void AddConditionItem(MatchMode matchMode, string name, string value)
        {
            MatchRuleChecker.Check(matchMode, name);
            switch (matchMode)
            {
            case MatchMode.Exact:
                _conds.Add(new EqualConditionItem(name, value, TupleType.Three));
                break;

            case MatchMode.StartWith:
                _conds.Add(new StartWithConditionItem(name, value));
                break;

            default:
                throw new InvalidEnumArgumentException("Unsupported match mode " +
                                                       matchMode);
            }
        }
Example #2
0
 /// <summary>
 /// 采用默认匹配方式(精确匹配)添加Conditions项。
 /// </summary>
 /// <param name="name">Condition名称。</param>
 /// <param name="value">Condition数值。</param>
 public void AddConditionItem(string name, string value)
 {
     MatchRuleChecker.Check(MatchMode.Exact, name);
     _conds.Add(new EqualConditionItem(name, value));
 }