title: When exactly does Entity Framework Fire a SQL Command?
body: <p>Suppose I have code like:</p>
  
  <pre><code>public void TestWhenSqlFires()
  {
      var db = new Db(); // EF DbContext
      var items = db.SimpleObjects; // SimpleObject implements interface IId
      var byId = WhereId(items, 1);
      var array = byId.ToArray();
  }
  
  protected IEnumerable&lt;IId&gt; WhereId(IEnumerable&lt;IId&gt; items, int id)
  {
      return items.Where(i =&gt; i.Id == id);
  }
  </code></pre>
  
  <p>At what line in TestWhenSqlFires() will SQL actually be run against the database?</p>
  
  <p>(This is a question that spun off from comments on <a href="https://stackoverflow.com/a/15845220/176877">this answer</a>)</p>