title: Entity Framework Core Navigation Properties Error
body: <p>I'm trying to make a simple app to try Entity Framework Core, but i a have problem with setting up relations between entities. My entities:</p>
  
  <pre><code>public class Card
  {
      [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
      public int Id { get; set; }
      public string Name { get; set; }
      public string Surname { get; set; }
      public string Adress { get; set; }
      public DateTime DoB { get; set; }
      public DateTime DoS { get; set; }
      public User Portal { get; set; }
      public List&lt;Reservation&gt; Res { get; set; }
  }
  public class Doctor
  {
      [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
      public int Id { get; set; }
      public string Name { get; set; }
      public string Surname { get; set; }
      public string Email { get; set; }
      public TimeSpan Start_Working { get; set; }
      public TimeSpan End_Working { get; set; }
      public List&lt;Reservation&gt; Reservations { get; set; }
      public int SpecID { get; set; }
      public Spec Spec { get; set; }
  }
  public class Reservation
  {
      [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
      public int Id { get; set; }
      public DateTime DoR { get; set; }
      public string Info { get; set; }
      public int CardID { get; set; }
      public Card Card_Nav_R { get; set; }
      public int DoctorID { get; set; }
      public Doctor Doctor { get; set; }
  }
  public class Spec
  {
      [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
      public int Id { get; set; }
      public string Name { get; set; }
      public List&lt;Doctor&gt; Doctors { get; set; }
  }
  public class User
  {
      [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
      public int Id { get; set; }
      public string Email { get; set; }
      public string Password { get; set; }
      public int CardID { get; set; }
      public Card Card { get; set; }
  }
  </code></pre>
  
  <p>And a configuration class where i tried to set up relations:</p>
  
  <pre><code>class ApplicationContext:DbContext
  {
      public DbSet&lt;User&gt; Users { get; set; }
      public DbSet&lt;Card&gt; Cards { get; set; }
      public DbSet&lt;Reservation&gt; Reservations { get; set; }
      public DbSet&lt;Doctor&gt; Doctors { get; set; }
      public DbSet&lt;Spec&gt; Specs { get; set; }
  
      public ApplicationContext()
      {
          Database.EnsureCreated();
      }
      protected override void OnModelCreating(ModelBuilder ModelBuilder)
      {
            ModelBuilder.Entity&lt;User&gt;().HasKey(u =&gt; u.Id);
            ModelBuilder.Entity&lt;Card&gt;().HasKey(c =&gt; c.Id);
            ModelBuilder.Entity&lt;Doctor&gt;().HasKey(d =&gt; d.Id);
            ModelBuilder.Entity&lt;Spec&gt;().HasKey(s =&gt; s.Id);
            ModelBuilder.Entity&lt;Reservation&gt;().HasKey(r =&gt; r.Id);
  
            ModelBuilder.Entity&lt;User&gt;().Property(u =&gt; u.Email).IsRequired();
            ModelBuilder.Entity&lt;User&gt;().Property(u =&gt; u.Password).IsRequired();
  
            ModelBuilder.Entity&lt;Card&gt;().Property(c =&gt; c.Name).IsRequired();
            ModelBuilder.Entity&lt;Card&gt;().Property(c =&gt; c.Surname).IsRequired();
            ModelBuilder.Entity&lt;Card&gt;().Property(c =&gt; c.DoB).IsRequired();
            ModelBuilder.Entity&lt;Card&gt;().Property(c =&gt; c.Adress).IsRequired();
  
            ModelBuilder.Entity&lt;Doctor&gt;().Property(d =&gt; d.Name).IsRequired();
            ModelBuilder.Entity&lt;Doctor&gt;().Property(d =&gt; d.Surname).IsRequired();
            ModelBuilder.Entity&lt;Doctor&gt;().Property(d =&gt; d.Spec).IsRequired();
            ModelBuilder.Entity&lt;Doctor&gt;().Property(d =&gt; d.Email).IsRequired();
            ModelBuilder.Entity&lt;Doctor&gt;().Property(d =&gt; d.Start_Working).IsRequired();
            ModelBuilder.Entity&lt;Doctor&gt;().Property(d =&gt; d.End_Working).IsRequired();
  
            ModelBuilder.Entity&lt;Reservation&gt;().Property(r =&gt; r.Info).IsRequired();
            ModelBuilder.Entity&lt;Reservation&gt;().Property(r =&gt; r.Card_Nav_R).IsRequired();
            ModelBuilder.Entity&lt;Reservation&gt;().Property(r =&gt; r.Doctor).IsRequired();
            ModelBuilder.Entity&lt;Reservation&gt;().Property(r =&gt; r.DoR).IsRequired();
  
          ModelBuilder.Entity&lt;Spec&gt;().Property(s =&gt; s.Name).IsRequired();
  
            ModelBuilder.Entity&lt;Doctor&gt;().HasOne&lt;Spec&gt;(d=&gt;d.Spec).WithMany(s =&gt; s.Doctors).HasForeignKey(d =&gt; d.SpecID);
            ModelBuilder.Entity&lt;User&gt;().HasOne&lt;Card&gt;(u =&gt; u.Card).WithOne(c =&gt; c.Portal).HasForeignKey&lt;User&gt;(u =&gt; u.CardID);
            ModelBuilder.Entity&lt;Reservation&gt;().HasOne&lt;Card&gt;(r =&gt; r.Card_Nav_R).WithMany(c =&gt; c.Res).HasForeignKey(r =&gt; r.CardID);
            ModelBuilder.Entity&lt;Reservation&gt;().HasOne&lt;Doctor&gt;(r =&gt; r.Doctor).WithMany(d =&gt; d.Reservations).HasForeignKey(r =&gt; r.DoctorID); 
  
      }
      protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
      {
          optionsBuilder.UseSqlServer("Server=(localdb)\\mssqllocaldb;Database=Simple_Try;Trusted_Connection=True;");
      }
  }
  </code></pre>
  
  <p>So, when i tried to add migration or add something to database i saw this error:</p>
  
  <blockquote>
    <p>System.InvalidOperationException: 'The property or navigation 'Spec' cannot be added to the entity type 'Doctor' because a property or navigation with the same name already exists on entity type 'Doctor'.'</p>
  </blockquote>
  
  <p>I really don't know how to fix this, i tried to use annotations instead of Fluent API, but had the same result.</p>