Sub types and left joins

Posts   
 
    
MattE avatar
MattE
User
Posts: 77
Joined: 11-Sep-2007
# Posted on: 19-Feb-2010 14:02:56   

Hi there,

I have read this post:

http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=7576&HighLight=1

I have a similar problem:

    IDCollection idCollection= new IDCollection();
    idCollection.GetMulti(new PredicateExpression(IDFields.FollowUpRequired ==1));

ID is a supertype of a number of other entities, (some of which have subtypes of their own). When i run this code, the generated SQL contains a series of left joins down the inheritance hierarchy, none of which I am looking to have populated. I really just want the a collection of populated Id entities.

So: Is it not possible to return simply the bare bones entities, using GetMulti ?

Our libraries are built on .net 3.5, C# self servicing with the latest LLBLGen binaries.

thanks,

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 19-Feb-2010 16:59:53   

You ask for ID entities, all subtypes are also IDentities, (as inheritance means: is-a, so subtype is-a supertype). This means that if you just want the IDentities, use a type filter. This still means you'll get the left joins. If you don't want that either (i.e. get rid of the left joins), use a projection or map a separate entity onto the same target and use that for your fetching instead in the situation where you want just the IDentity instances. Be aware though that if you then modify a row in that list, it means you could edit a subtype as well. If you just want all supertypes and not the subtypes, use a typefilter on the supertype.

Frans Bouma | Lead developer LLBLGen Pro
MattE avatar
MattE
User
Posts: 77
Joined: 11-Sep-2007
# Posted on: 22-Feb-2010 07:23:36   

Thanks - Yes, I realized the inheritance implication was the cause of the joins.

I'll look into the type filter implementation.