title: Why is my DbModelBuilder configuration ignored when mapping Entity from DbSet<T>.SqlQuery?
body: <p>I have a <code>DbModel</code> configuration like so:</p>
  
  <pre><code>modelBuilder.Entity&lt;WishlistLine&gt;()
              .HasKey(w =&gt; w.PersistenceKey)
              .Property(w =&gt; w.PersistenceKey)
              .HasColumnName("WishlistLineId");
  </code></pre>
  
  <p>I have a query run via the following two methods:</p>
  
  <pre><code>public IEnumerable&lt;WishlistLine&gt; FetchWishlistLinesUsingLogonName(string logonName)
  {
          return GetFromRawSql(@"
      SELECT wl.* FROM WishlistLines wl
      INNER JOIN Accounts a ON wl.AccountId = a.AccountId 
      LEFT JOIN Users u ON u.AccountId = a.AccountId
      WHERE u.LogonName = @p0", logonName);
  }
  
  protected IEnumerable&lt;TEntity&gt; GetFromRawSql(string sqlQuery, params object[] parameters)
  {
      return _dbSet.SqlQuery(sqlQuery, parameters).ToList();
  }
  </code></pre>
  
  <p>I can "save" <code>WishlistLines</code> into the database through EF without any problems. When I run this query though I get this error:</p>
  
  <p><code>The data reader is incompatible with the specified 'DataAccessLayer.DatabaseContext.WishlistLine'. A member of the type, 'PersistenceKey', does not have a corresponding column in the data reader with the same name.</code></p>
  
  <p>I understood that using <code>DbSet&lt;T&gt;.SqlQuery()</code> would map the returned data to the entities but it seems to be ignoring the <code>DbModel</code> configurations. Judging (guessing) from the error message the wrong data reader is being used.</p>
  
  <p>so:</p>
  
  <p>A) am I doing anything wrong?</p>
  
  <p>B) is there a way to make use of EF's <code>DbModel</code>-aware entity mapper?</p>