Designer generated LINQ generates wrong SQL when table is joined multiple times

Posts   
1  /  2
 
    
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39617
Joined: 17-Aug-2003
# Posted on: 07-Feb-2018 12:05:51   

Reproduced with the query you gave, and store being a TPE subtype of customer.

Looks like it tries to find 'Rowguid' and as the subtype field name is changed, it finds one but that's the wrong one.

I hope this is fixable...

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39617
Joined: 17-Aug-2003
# Posted on: 07-Feb-2018 14:22:41   

Man, you won't believe it. I really was stumped how to fix this, it felt impossible, as the place where it adds the fields to the various projections doesn't know about derived tables yet.

I noticed however that the code which constructs the list of fields to add to the projection when it adds the whole entity to the projection (the select new {c, soh}) used the wrong hierarchyfields call and the inherited fields weren't marked as fields in a subtype.

Corrected that and the fix issued earlier in this thread now picked up the renamed field and it works now also in this scenario, like it should.

pfew simple_smile

Releasing new hotfixes in a minute

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39617
Joined: 17-Aug-2003
# Posted on: 07-Feb-2018 16:46:11   

Hotfix 5.2.6 and 5.3.3 fix this issue.

Frans Bouma | Lead developer LLBLGen Pro
TomDog
User
Posts: 618
Joined: 25-Oct-2005
# Posted on: 08-Feb-2018 12:03:53   

Sounds like a relatively easy fix once you found it. It can be a relief when a bug is just a mistake rather than a scenario that hasn't been catered for.

Thanks for sorting it simple_smile

Jeremy Thomas
1  /  2