title: Mapping properties to (differently named) foreign key fields in Entity Framework CTP5
body: <p>I'm trying to use the Entity Framework CTP5 Fluent API to map an exist database. I have the following classes:</p>
  
  <pre><code>public class Shop
  {
      public long Id
      {
          get;
          set;
      }
  }
  
  public class Sale
  {
      public long Id
      {
          get;
          set;
      }
  
      public virtual Shop Shop
      {
          get;
          set;
      }
  }
  </code></pre>
  
  <p>The corresponding tables are called "Stores" and "Sales". Sales has a StoreId foreign key that points to the Id field in the Stores table.</p>
  
  <p>I'm struggling to map the Sale.Shop.Id to the StoreId in the table. I'm not at liberty to change it to ShopId, so need to map it.</p>
  
  <p>In CTP4, I was using:</p>
  
  <pre><code>modelBuilder.Entity&lt;Sale&gt;().MapSingleType(x =&gt;
      new
      {
          Id = x.Id,
          StoreId = x.Shop.Id
      });
  </code></pre>
  
  <p>I tried the following:</p>
  
  <pre><code>modelBuilder.Entity&lt;Sale&gt;().Property(x =&gt; x.Shop.Id).HasColumnName("StoreId");
  </code></pre>
  
  <p>However, it seems this only works with a primitive type.</p>
  
  <p>How do I specify this mapping? </p>