title: How to set foreign key where column names are different using Entity Framework 5 Fluent API?
body: <p>I am trying to establish a foreign key relationship between following domain classes using Fluent API (Entity Framework v5):</p>
  
  <pre><code>public partial class User
  {
      public long UserID { get; set; }
      public string UserName { get; set; }
  }
  public partial class AccountGroup : BaseEntity
  {
      public long AccountGroupID { get; set; }
      public string Name { get; set; }
      public long ModifiedBy { get; set; }
      public virtual User User { get; set; }
  }
  </code></pre>
  
  <p>Fluent API</p>
  
  <pre><code>builder.Entity&lt;User&gt;().HasKey(p =&gt; p.UserID); //Set User Id as primary key
  builder.Entity&lt;AccountGroup&gt;().HasKey(x =&gt; x.AccountGroupID); //SetAccountGroupId as PK
  </code></pre>
  
  <p>I am not sure how to set a relationship between User.UserId and AccountGroup.ModifiedBy column using fluent API. I can do this by Data Annotation but I am looking for a solution using fluent api</p>