Prefetch / Inheritance and building a custom graph

Posts   
 
    
Posts: 94
Joined: 23-Aug-2006
# Posted on: 21-Aug-2013 02:28:07   

We went ahead and put the question together with diagram and SQL statements in the attached document. I am sure this is possible to build in LLBLGen but we cant seem to figure out how.

Attachments
Filename File size Added on Approval
LLBLGEN Entity Relationship issue.docx 217,343 21-Aug-2013 02:28.31 Approved
Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 22-Aug-2013 04:25:15   

To which field does the PurchaseOrderId in AcountPayableDetail point to?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 22-Aug-2013 13:50:33   

The doc says it's not using a PK on the PK side but a UC, which means the relationship isn't recognized. As the relationship isn't recognized you can't map a reference/collection (field) on the relationship, so you can't use a prefetch path for this relationship (edge).

I wonder why the fk in the DB points to a UC. The whole AccountsPayableDetail table is odd to me as well.

We would like to bring AccountsPayable entity with its related AccountPayableDetails colletion

This doesn't make sense to me as well: the diagram doesn't show any direct relationship between the two, even through supertypes. AccountPayableDetail is related to AccountTransactionDetail, but that isn't directly related to AccountsPayable.

Frans Bouma | Lead developer LLBLGen Pro
Posts: 94
Joined: 23-Aug-2006
# Posted on: 22-Aug-2013 14:27:37   

Thanks for confirming that our workaround idea wouldn't work. Your answers confirm my suspicion. In short, we can't get there from here. The dev working on this was literally interested in "grafting" a SuperType/SubType graph onto another one which, as you saw, is not directly related. The primary purpose for asking this was the notion that he could work on the entire graph in one shot. We certainly don't have to do that way, he can load two graphs and work on them respectively. Seems he was able to build similar graphs using EF and wanted to try for the same in LLBLGen.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 22-Aug-2013 15:26:10   

EF doesn't support relationships without a PK so I doubt he managed to make it work there (in fact, EF doesn't support UCs at all)

If the relationship is properly setup with a pk-fk relationship, you can map a field onto the relationship and it's fetchable through a prefetch path though.

Frans Bouma | Lead developer LLBLGen Pro
Posts: 94
Joined: 23-Aug-2006
# Posted on: 22-Aug-2013 18:28:42   

Thanks Frans. ( I'm ignorant when it comes to EF, I always felt it was a very poor and inefficient implementation - the sort of thing that happens when you have a few dozen devs with not much to do trying to build everything and the kitchen sink into an ORM)