title: Why does the rule executes multiple times in the context of an object?
body: <p>There is a container class which has a collection of integers. My objective is to calculate the sum of all the integers. I am using the workflow rule engine here. The two rules written are somewhat like follows:</p>
  
  <pre><code>RuleName: Initializer
  Priority: 2
  Condition : 1==1
  ThenActions: 
      this.i = 0;
  ReEvaluationBehavior: Always
  
  ----
  
  RuleName: Looping
  Priority: 1
  Condition: this.i &lt; this.Items.Count
  ThenActions:
      this.total = this.total + this.Items[this.i];
      this.i = this.i + 1;
  ReEvaluationBehavior: Always
  </code></pre>
  
  <p>This is just an abstract representation. The Container class is defined as:</p>
  
  <pre><code>public class NumberContainer
  {
      public int i;
      public int ItemCount 
      {
          get
          {
              return this.Items.Length;
          }
  
          private double total;
  
          public double Total
          {
              get { return total; }
              set { total = value; }
          }
  
          private double[] items;
  
          public double[] Items
          {
              get { return items; }
              set { items = value; }
          }
  
          //Other stuff...
      }
  }
  </code></pre>
  
  <p>I've only shown the important fields here. All of this (i.e the populated container object and the ruleset) is fed to the rule engine to execute.</p>
  
  <p>Why does the <code>Looping</code> rule execute multiple times whereas <code>Initializer</code> rule only executes once? Is it something to do with Chaining? Is it the fact that we are setting the value of <code>i</code> in the <code>Looping</code> rule, and the same variable happens to be a part of the corresponding rule's condition?</p>