Consider a situation where you have to map a complex class hierarchy with minimal database tables. Which inheritance strategy would you choose and what are its implications?
- 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.
Table per Hierarchy (TPH) strategy would be chosen. TPH reduces the number of database tables required by mapping all properties from all classes to a single database table. This strategy simplifies the database schema, making it easier to manage and understand. However, it may result in NULL values for properties specific to certain derived types, impacting database performance and storage efficiency.
Loading...
Related Quiz
- How can compiled queries improve performance in Entity Framework?
- What role does data archiving play in database migration?
- ________ loading can potentially lead to the N+1 query problem in Entity Framework.
- What is the significance of the OnModelCreating method in DbContext?
- How does Fluent API provide more flexibility than Data Annotations when configuring relationships?