In a scenario where an application requires polymorphic behavior, which Entity Framework inheritance strategy would be most suitable and why?

  • Joined Tables (JT): Each class in the hierarchy maps to its own database table, with a one-to-one relationship between the base class table and derived class tables.
  • Table per Concrete Type (TPC): Each class maps to its own database table, including inherited properties.
  • Table per Hierarchy (TPH): All properties from all classes are mapped to a single database table.
  • Table per Type (TPT): Each class in the hierarchy maps to its own database table.
Joined Tables (JT) strategy would be most suitable. In scenarios requiring polymorphic behavior, Joined Tables allow for efficient querying and maintainability. Each class in the hierarchy maps to its own table, with a one-to-one relationship between the base class table and derived class tables. This strategy ensures database normalization while providing flexibility and clarity in the database structure.
Add your answer
Loading...

Leave a comment

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