コード例 #1
0
        public IRule Translate(RuleData ruleData)
        {
            if (ruleData == null)
            {
                throw new ArgumentNullException("ruleData");
            }

            RuleOperator ruleOperator;
            var          rule = Enum.TryParse(ruleData.RuleOperator, false, out ruleOperator) ? _factory.Create(ruleOperator, ruleData.Field, ruleData.Value) : NullRule;

            rule.ValidationMessage = ruleData.ValidationMessage;
            return(rule);
        }
コード例 #2
0
 public IRule Convert(RuleData ruleData)
 {
     return(Convert(new List <RuleData> {
         ruleData
     }).Single());
 }