What is Table-per-Hierarchy (TPH) inheritance in Entity Framework?

  • Each type in the inheritance hierarchy is mapped to a separate file in the project.
  • Each type in the inheritance hierarchy is mapped to a single table in the database.
  • Each type in the inheritance hierarchy is mapped to its own schema in the database.
  • Each type in the inheritance hierarchy is mapped to its own table in the database.
Table-per-Hierarchy (TPH) inheritance in Entity Framework maps all derived types in an inheritance hierarchy to a single database table. This means all properties of the derived types are stored in one table, and a discriminator column is used to differentiate between the types. This approach is useful when the derived types share most of their properties and have only a few unique properties. It simplifies the database schema but may lead to null values in the table for properties that are specific to certain derived types.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *