overview
EF Core supports three strategies of mapping .NET types:
- Table-per-Hierarchy (TPH) — the default strategy; maps .NET types to a single database table
- Table-per-Type (TPT) — maps each .NET type to a different database table
- Table-per-Concrete-Type (TPC)
ℹ️ Important
Availability: EF Core 7
- Like TPT, but in a way that addresses problems with that strategy.
- Documentation: https://learn.microsoft.com/en-us/ef/core/what-is-new/ef-core-7.0/whatsnew#table-per-concrete-type-tpc-inheritance-mapping By default, EF Core maps an inheritance hierarchy of .NET types to a single hierarchy.
guidance
- Prefer TPH unless the below applies.
- Use TPC when code will mostly query for entities of a single leaf type.
- Use TPT only if constrained to do so by external factors.