title: Differences when using IEnumerable and IQueryable as a type of ObjectSet
body: <p>As I understand it when I use LINQ extension methods (with lambda expression syntax) on <code>IQueryable</code> that is in the fact instance of <code>ObjectSet</code> they are translated into LINQ to SQL queries. What I mean is that command</p>
  
  <pre><code>IQueryable&lt;User&gt; users = db.UserSet;
  var users32YearsOld = users.Where(user =&gt; user.Age == 32);
  </code></pre>
  
  <p>is exactly the same as</p>
  
  <pre><code>IQueryable&lt;User&gt; users = db.UserSet;   
  var users32YearsOld = from user in users where user.Age == 32 select user;
  </code></pre>
  
  <p>So non of them hits database until they <code>users32YearsOld</code> are enumerated in for cycle or such. (Hope I understand this correctly).</p>
  
  <p>But what is going to happen if I don't mask that <code>ObjectSet</code> as <code>IQueryable</code> but as <code>IEnumerable</code> ? So if the type of it is <code>IEnumerable</code> ?</p>
  
  <pre><code>IEnumerable&lt;User&gt; users = db.UserSet;
  var users32YearsOld = users.Where(user =&gt; user.Age == 32);
  </code></pre>
  
  <p>Is it going to hit the database immediately (if so then when ? Right on the first line or on the second) ? Or is it going to behave as the previous command that is will not hit database until <code>users32YearsOld</code> is enumerated ? Will there be any difference if I use following instead ?</p>
  
  <pre><code>IEnumerable&lt;User&gt; users = db.UserSet;
  var users32YearsOld = from user in users where user.Age == 32 select user;
  </code></pre>
  
  <p>Thank you</p>