title: Unable to create a constant value of type Only primitive types or enumeration types are supported in this context
body: <p>I am getting this error for the query below</p>
  
  <blockquote>
    <p>Unable to create a constant value of type <code>API.Models.PersonProtocol</code>. Only primitive types or enumeration types are supported in this context</p>
  </blockquote>
  
  <p><code>ppCombined</code> below is an <code>IEnumerable</code> object of <code>PersonProtocolType</code>, which is constructed by concat of 2 <code>PersonProtocol</code> lists.</p>
  
  <p>Why is this failing? Can't we use LINQ <code>JOIN</code> clause inside of <code>SELECT</code> of a <code>JOIN</code>? </p>
  
  <pre><code>var persons = db.Favorites
      .Where(x =&gt; x.userId == userId)
      .Join(db.Person, x =&gt; x.personId, y =&gt; y.personId, (x, y) =&gt;
          new PersonDTO
          {
              personId = y.personId,
              addressId = y.addressId,                   
              favoriteId = x.favoriteId,
              personProtocol = (ICollection&lt;PersonProtocol&gt;) ppCombined
                  .Where(a =&gt; a.personId == x.personId)
                  .Select( b =&gt; new PersonProtocol()
                   {
                       personProtocolId = b.personProtocolId,
                       activateDt = b.activateDt,
                       personId = b.personId
                   })
          });
  </code></pre>