title: Adding a second one-to-one relationship with the same table in entity framework
body: <p>I am doing code-first entity framework design.</p>
  
  <p>I have a table, Account, which has a property, Supervisor:</p>
  
  <pre><code>public class Account
  {
    public int Id { get; set; }
    public Account Supervisor { get; set; }
  }
  </code></pre>
  
  <p>This works beautifully.</p>
  
  <p>However, I wish to add an alternate supervisor to the class:</p>
  
  <pre><code>public class Account
  {
    public int Id { get; set; }
    public Account Supervisor { get; set; }
    public Account AlternateSupervisor { get; set; }
  }
  </code></pre>
  
  <p>When I run Add-Migration AddAlternateSupervisor, the generated code gives me the following:</p>
  
  <pre><code>public partial class AddAlternateSupervisor : Migration
  {
      protected override void Up(MigrationBuilder migrationBuilder)
      {
          migrationBuilder.DropForeignKey(
              name: "FK_Accounts_Accounts_SupervisorId",
              table: "Accounts");
  
          migrationBuilder.DropIndex(
              name: "IX_Accounts_SupervisorId",
              table: "Accounts");
  
          migrationBuilder.AddColumn&lt;int&gt;(
              name: "AlternateSupervisorId",
              table: "Accounts",
              nullable: true);
  
          migrationBuilder.CreateIndex(
              name: "IX_Accounts_AlternateSupervisorId",
              table: "Accounts",
              column: "AlternateSupervisorId",
              unique: true,
              filter: "[AlternateSupervisorId] IS NOT NULL");
  
          migrationBuilder.AddForeignKey(
              name: "FK_Accounts_Accounts_AlternateSupervisorId",
              table: "Accounts",
              column: "AlternateSupervisorId",
              principalTable: "Accounts",
              principalColumn: "Id",
              onDelete: ReferentialAction.Restrict);
      }
      // snip
  }
  </code></pre>
  
  <p>As you can see, EF is trying to rename my reference from Supervisor to AlternateSupervisor.  I don't want that, I want both Supervisor and AlternateSupervisor to reference other accounts.</p>
  
  <p>I know that EF can't handle multiple many-to-many relationships, but these are one to one relationships.  I can't seem to find any information on why EF is generating the migration like this.</p>
  
  <p>So why is Entity Framework trying to rename Supervisor to AlternateSupervisor and how can I force it to generate both links?</p>
  
  <p>EDIT: This question was answered as initially asked.  However, I would like to add that as asked the question doesn't really make much domain sense.  Who ever heard of an account that could only ever supervise exactly one other account?  The relationship is a one to many relationship, which is resolved by the use of WithMany instead of WithOne.</p>