Mid EF Core

How to handle self-referencing tables (e.g. Employee has manager, manager is also Employee)?

  • Define navigation property and foreign key for self-reference.
  • Use Fluent API: .HasOne(e => e.Manager).WithMany(e =>

e.Subordinates).

More from Entity Framework Core Tutorial

All questions for this course