title: System.Data.SqlClient.SqlException : Invalid Column Name 'Machine_Id'
body: <p>I have a code first db using EF 6.<br />
  I'm facing the <a href="https://stackoverflow.com/questions/19959256/entity-framework-invalid-column-name-id">similar issue</a>. I tried all the answers but none of them worked out.</p>
  <p>My entities are:</p>
  <pre><code>public class UtilizationSummary
  {
      public DateTime SummaryDate { get; set; }
      public Int32 ProcessKey { get; set; }
      public virtual ProcessInfo ProcessInfo { get; set; }
      public Guid MachineId { get; set; }
      public virtual Machine Machine { get; set; }
  }
  
  public class ProcessInfo
  {
       public virtual Machine Machine { get; set; }
       public virtual Session Session { get; set; }
  }
  
  public class Machine
  {
       public Guid Id { get; set; }
       public String Sid { get; set; }
  }
  </code></pre>
  <p>Mappings are as follows:</p>
  <pre><code>public class UtilizationSummaryMap: EntityTypeConfiguration&lt;UtilizationSummary&gt;
  {
       this.HasKey(pus=&gt; new { pus.MachineId, pus.SummaryDate, pus.ProcessKey });
       this.Property(pus=&gt; pus.MachineId).IsRequired();
       this.HasRequired(pus=&gt; pus.Machine).WithMany().HasForeignKey(ma =&gt; ma.MachineId);
  }
  </code></pre>
  <p>Accessing using:</p>
  <pre><code>[HttpGet]
  [ODataRoute(&quot;UtilizationSummary&quot;)]
  [EnableQuery]
  public IQueryable&lt;UtilizationSummary&gt; FilterUtilizationSummary() 
  {
      var expression = ...some expression..;
      var result = db.UtilizationSummary.Where(expression);
      return result;
  }
  </code></pre>
  <p>The following exception is being thrown at 'return result':</p>
  <pre><code>&quot;message&quot;:&quot;Invalid column name 'Machine_Id'.&quot;,&quot;type&quot;:&quot;System.Data.SqlClient.SqlException&quot;
  </code></pre>
  <p>Printing <code>result</code> gives:</p>
  <pre><code>SELECT 
      [Extent1].[ProcessKey] AS [ProcessKey], 
      [Extent1].[MachineId] AS [MachineId], 
      [Extent1].[SummaryDate] AS [SummaryDate],  
      [Extent1].[Machine_Id] AS [Machine_Id]
  FROM [ProcessUtilizationMinuteSummary] AS [Extent1]
  </code></pre>
  <p>I'm not getting why it is trying to access <code>Machine_Id</code> though i have given the mapping for foriegn key.</p>
  <p>Thanks in advance :)</p>