Entity Framework Multi-level TPH

292 Views Asked by At

Let us say that I have an Address table which can be used by two different tables. The SourceID determines which table we are joining on. This has been split out using TPH and a condition that SourceID = 1. This works great. I also want to be able to go a step further and have another entity that has 2 conditions (SourceID = 1 and TypeID =2). I have tried inheriting from my first child entity, but the SQL produced does not take into account both conditions (the SourceID = 1 condition from the first derived entity and the TypeID = 2 from the newly derived entity)

Is there any way to be able to have a multi-level hierarchy with TPH so that I have different types based on a set of conditions? Thanks for your help!

0

There are 0 best solutions below