title: Entity Framework 4.3 code first multiple many to many using the same tables
body: <p>I have a model like</p>
  
  <pre><code>public class User
  {
      [Key]
      public long UserId { get; set; }
  
      [Required]
      public String Nickname { get; set; }
  
      public virtual ICollection&lt;Town&gt; Residencies { get; set; }
  
      public virtual ICollection&lt;Town&gt; Mayorships { get; set; }
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>public class Town
  {
      [Key]
      public long TownId { get; set; }
  
      [Required]
      public String Name { get; set; }
  
      public virtual ICollection&lt;User&gt; Residents { get; set; }
      public virtual ICollection&lt;User&gt; Mayors { get; set; }
  }
  </code></pre>
  
  <p>I was hoping EF would create two many to many relationships using automatically created TownResidents and TownMayors table.  I can't seem to find the necessary convention or explicit annotation to get this result.</p>
  
  <p>Instead I am getting two FK UserIds in the Town table and two FK TownIds in the User table.  </p>
  
  <p>Any ideas how to get EF to see these at two many to many relationships?  </p>
  
  <p>Thanks     </p>