title: How to implement a rule engine?
body: <p>I have a db table that stores the following:</p>
  
  <pre><code>RuleID  objectProperty ComparisonOperator  TargetValue
  1       age            'greater_than'             15
  2       username       'equal'             'some_name'
  3       tags           'hasAtLeastOne'     'some_tag some_tag2'
  </code></pre>
  
  <p>Now say I have a collection of these rules:</p>
  
  <pre><code>List&lt;Rule&gt; rules = db.GetRules();
  </code></pre>
  
  <p>Now I have an instance of a user also:</p>
  
  <pre><code>User user = db.GetUser(....);
  </code></pre>
  
  <p>How would I loop through these rules, and apply the logic and perform the comparisons etc?</p>
  
  <pre><code>if(user.age &gt; 15)
  
  if(user.username == "some_name")
  </code></pre>
  
  <p>Since the object's property like 'age' or 'user_name' is stored in the table, along with the comparison operater 'great_than' and 'equal', how could I possible do this?</p>
  
  <p>C# is a statically typed language, so not sure how to go forward.</p>