I have a complex data model (for EF 4.1 code first) that uses composition (many 1-to-1’s) to achieve benefits similar to multiple inheritance. But I have a problem to solve, hopefully with mapping.
-
I need to reduce the number of tables (not entities) to simulate
successful multiple inheritance. -
I cannot replace the 1-to-1 composition classes with complex types
because I will use Dynamic Data as an admin back-end and DD doesn’t
work with complex types. -
Table-per-hierarchy does not seem it would help here because of the
simulated multiple inheritance. -
Table-per-type would give way too many tables.
I think there is something called “entity splitting”. And I think I basically need the opposite of it? I wonder if what I want is even possible… basically simulating complex types by mapping model components more than once.. it sounds impossible. Should I just scrap the composition approach? I could always group properties with attributes or something.
The opposite of entity splitting is called table splitting and it is really possible but it has one big problem happening only in EF code first.