title: EF5 generating "imaginary" columns in select statements
body: <p>We are using C#. VS2012, EF 5.0, and Oracle 11g.  Approach is code first.  I have a table that is defined, and it is plainly visible in looking at the code that it is defined with all the correct columns (and none that are not there.)</p>
  
  <p>Still, when I run certain LINQ queries (joins) and attempt to select the results into a new object, things break.  Here is the LINQ:</p>
  
  <pre><code>IQueryable&lt;CheckWage&gt; query =
      from clientWage in context.ClientWages
      join paycheckWage in context.PaycheckWages
          on
          new {clientWage.PermanentClientId, clientWage.WageId} equals
          new {paycheckWage.PermanentClientId, paycheckWage.WageId}
      where
          (paycheckWage.PermanentClientId == Session.PermanentClientId) &amp;&amp;
          (clientWage.PermanentClientId == Session.PermanentClientId)
      select new CheckWage
          {
              CWage = clientWage,
              PWage = paycheckWage
          };
  </code></pre>
  
  <p>Now, here is the SQL it emits (as captured by Devart's DbMonitor tool):</p>
  
  <pre><code>SELECT 
  "Extent1".ASSOCIATE_NO,
  "Extent1".PCLIENT_ID,
  "Extent1".CLIENT_NO,
  "Extent1".CLIENT_NAME,
  "Extent1".ADDRESS1,
  "Extent1".ADDRESS2,
  "Extent1".CITY,
  "Extent1".STATE,
  "Extent1".ZIP,
  "Extent1".COUNTRY,
  "Extent1".CLIENT_TYPE,
  "Extent1".DOING_BUSINESS_AS,
  "Extent1".CONTACT,
  "Extent1".PHONE,
  "Extent1".EXTENSION,
  "Extent1".FAX,
  "Extent1".FAX_EXTENSION,
  "Extent1".EMAIL,
  "Extent1".NEXTEMP,
  "Extent1".PAY_FREQ,
  "Extent1".EMPSORT,
  "Extent1".DIVUSE,
  "Extent1".CLIENT_ACCESS_TYPE,
  "Extent1".AUTOPAY_WAGE_ID,
  "Extent1".FEIN,
  "Extent1".HR_MODULE,
  "Extent1".BANK_CODE,
  "Extent1".ACH_DAYS,
  "Extent1".ACH_COLLECT,
  "Extent1".UPDATED,
  "Extent1".IAT_FLAG,
  "Extent1".ORIG_EMAIL,
  "Extent1"."R1",
  "Extent1"."R2"
  FROM INSTANTPAY.CLIENT "Extent1"
  WHERE "Extent1".PCLIENT_ID = :EntityKeyValue1'
  </code></pre>
  
  <p>There are no such columns as "R1" and "R2."  I am guessing is has something to do with the join into a new object type with two properties, but I am pulling my hair out trying to figure out what I've done or haven't done that is resulting in this errant SQL.  Naturally, the error from the Oracle server is "ORA-00904: "Extent1"."R2": invalid identifier."  Strange that is doesn't choke on R1, but perhaps it only lists the last error or something...</p>
  
  <p>Thanks in advance,
  Peter</p>
  
  <p><strong>5/23/2014: I left out an important detail.  The SQL is emitted when I attempt to drill into one of the CheckWage objects (using Lazy loading), as both of the contained objects have a navigation property to the "Client" entity.  I can access the client table just fine in other LINQ queries that do not use a join, it is only this one that creates the "R1" and "R2" in the SELECT statement.</strong></p>
  
  <p>Peter</p>