title: DbSet doesn't contain definition for FirstOrDefault?
body: <p>I recently migrated an existing project to .net 4.5 and changed out what this project was using for data access (switching to Entity Framework).</p>
  
  <p>For some reason any time I try to access any functions for a DbSet (<code>Where</code>, <code>First</code>, <code>FirstOrDefault</code>, etc) it throws the error:</p>
  
  <blockquote>
    <p>Error 53  'System.Data.Entity.DbSet<code>1&lt;MyProject.Data.Customer&gt;' does
    not contain a definition for 'FirstOrDefault' and no extension method
    'FirstOrDefault' accepting a first argument of type
    'System.Data.Entity.DbSet</code>1' could be found
    (are you missing a using directive or an assembly reference?</p>
  </blockquote>
  
  <p>This uses .net 4.5 and I read that these functions are no longer in System.Linq but are now stored in System.Core.  I have added a reference to System.Core to the project but I am still getting the error.  There is a using statement for System.Linq, but not for System.Core.</p>
  
  <p>Can anyone see why I would be getting this error?  Suggestions on how to fix?</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>This is the line that throws the error:</p>
  
  <pre><code>VIModel Db = new VIModel();
  Customer = Db.Customers.FirstOrDefault(c =&gt; c.CustomerId == CustomerId &amp;&amp; c.IsPrimary);
  </code></pre>
  
  <p>and my DbContext:</p>
  
  <pre><code>public partial class VIModel : DbContext
  {
       ........
       public virtual DbSet&lt;Customer&gt; Customers { get; set; }
       ........
  }
  </code></pre>