Entity Framework Core Interview Question #156
What is table splitting in EF Core?
Advanced Mapping, Interceptors, Value Conversions & Architecture Senior Advanced
Quick Interview Answer
Table splitting maps multiple entity types to the same database table, typically when the entities share the same primary-key value and represent different parts of one row. It can support specialized domain models or legacy schemas. Because configuration is more complex, use it only when the model benefits clearly from the separation.
Detailed Explanation
Table splitting maps multiple entity types to the same database table, typically when the entities share the same primary-key value and represent different parts of one row. It can support specialized domain models or legacy schemas. Because configuration is more complex, use it only when the model benefits clearly from the separation.
Code Example
modelBuilder.Entity<Order>()
.ToTable("Orders");
modelBuilder.Entity<OrderDetails>()
.ToTable("Orders");