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); }
public IRule Convert(RuleData ruleData) { return(Convert(new List <RuleData> { ruleData }).Single()); }