Entity Framework Core 5 — Table-per-Type and Table-per-Hierarchy

  • Microsoft.EntityFrameworkCore.Design 5.0.3
  • Microsoft.EntityFrameworkCore.SqlServer 5.0.3
  • Microsoft.EntityFrameworkCore.Tools 5.0.3
  • The class “Person” is the base class
  • The class “User” inherits from Person
  • The class “Client” also inherits from Person
System.InvalidOperationException: 'Cannot use table 'People' for entity type 'Person' since it is being used for entity type 'Person' and potentially other entity types, but there is no linking relationship. Add a foreign key to 'Person' on the primary key properties and pointing to the primary key on another entity typed mapped to 'People'.'
https://github.com/henriquesd/EntityFrameworkCore5Examples

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store