title: Linq to Entities query non primitive type
body: <p>I have this method I wrote as:</p>
  
  <pre><code>private void GetReceivedInvoiceTasks(User user, List&lt;Task&gt; tasks)
          {
              var taskList = from i in _db.Invoices
                             join a in user.Areas on i.AreaId equals a.AreaId
                             where i.Status == InvoiceStatuses.Received
                             select i;
  
          }
  </code></pre>
  
  <p>Basically I was trying to get all the Invoices in the database in the user's area that have a status of received. I don't understand LINQ too well right now.</p>
  
  <p>I'm getting the error:</p>
  
  <blockquote>
    <p>base {System.SystemException} = {"Unable to create a constant value of
    type 'Models.Area'. Only primitive types ('such as Int32, String, and
    Guid') are supported in this context."}</p>
  </blockquote>
  
  <p>Can someone please explain to me what I'm doing wrong and how to remedy this? I can't currently understand what the problem is. If I take the <code>join</code> line out it's fine but I really need that line to make sure I only have invoices from the users area/areas (they can belong to more than one area). Have I got something fundamentally wrong with this query?</p>