title: Do Linq to Entities queries *always* hit the database?
body: <p>My understanding of the Entity Framework is that if it can answer a query from its cache, it will.  My simple testing, however, shows repeated queries hit the database even though they were previously answered positively:</p>
  
  <pre><code>var u1 = context.Users.SingleOrDefault(u =&gt; u.Id == 1);
  var u2 = context.Users.SingleOrDefault(u =&gt; u.Id == 1);
  </code></pre>
  
  <p>These queries are successful.  For each, I see a <code>SELECT TOP (2)</code> in SQL Profiler.</p>
  
  <p>Why does EF go to the database for that second query?</p>