예제 #1
0
        /// <summary>
        /// Create a custom result type rule
        /// </summary>
        /// <param name="resultTypeRule">The result type rule info object</param>
        /// <returns>The property rule</returns>
        public PropertyRule CreateCustomPropertyRule(ResultTypeRuleInfo resultTypeRule)
        {
            var type             = typeof(PropertyRuleOperator);
            var info             = type.GetProperty("DefaultOperators", BindingFlags.NonPublic | BindingFlags.Static);
            var value            = info.GetValue(null);
            var defaultOperators = (Dictionary <PropertyRuleOperator.DefaultOperator, PropertyRuleOperator>)value;

            var rule = new PropertyRule(resultTypeRule.PropertyName, defaultOperators[resultTypeRule.Operator])
            {
                PropertyValues = new List <string>(resultTypeRule.Values)
            };

            return(rule);
        }
예제 #2
0
        /// <summary>
        /// Create a custom result type rule
        /// </summary>
        /// <param name="resultTypeRule">The result type rule info object</param>
        /// <returns>The property rule</returns>
        public PropertyRule CreateCustomPropertyRule(ResultTypeRuleInfo resultTypeRule)
        {
            var type = typeof(PropertyRuleOperator);
            var info = type.GetProperty("DefaultOperators", BindingFlags.NonPublic | BindingFlags.Static);
            var value = info.GetValue(null);
            var defaultOperators = (Dictionary<PropertyRuleOperator.DefaultOperator, PropertyRuleOperator>)value;

            var rule = new PropertyRule(resultTypeRule.PropertyName, defaultOperators[resultTypeRule.Operator])
            {
                PropertyValues = new List<string>(resultTypeRule.Values)
            };

            return rule;
        }