Too much data?

Posts   
 
    
dm.Frank
User
Posts: 21
Joined: 26-Apr-2013
# Posted on: 18-Dec-2014 16:04:54   

Hello,

this

ExcludeIncludeFieldsList fieldsAdresse = new ExcludeIncludeFieldsList(false); fieldsAdresse.Add(AdresseFields.AdresseName1); fieldsAdresse.Add(AdresseFields.AdresseName2);

prefetch.Add(ArztEntity.PrefetchPathArztMandanten, -1, predicate, null, null, null, fieldsAdresse).SubPath.Add(ArztMandantEntity.PrefetchPathMandant).SubPath.Add(MandantEntity.PrefetchPathAdresse);

results to

SELECT [Adresse].[AdresseGeburtsname], [Adresse].[AdresseGeburtsort], [Adresse].[AdresseGeburtstag], [Adresse].[AdresseId], [Adresse].[AdresseKennung], [Adresse].[AdresseName1], [Adresse].[AdresseName2], [Adresse].[AdresseName3], [Adresse].[AdresseOrt], [Adresse].[AdresseOrtsteil], [Adresse].[AdressePlz], [Adresse].[AdressePostfach], [Adresse].[AdressePostfachPlz], [Adresse].[AdresseStraße], [Adresse].[AdresseVerstorben], [Adresse].[AnredeAppAuswahllisteEintragId], [Adresse].[LandId], [Adresse].[XadrId] FROM [Adresse] WHERE ( ( ( [Adresse].[AdresseId] = @P1)))

It seems that LLBLGen allways fetches all (*) columns instead of fetching only the 2 wanted columns. This is not the expected behaviour and unnecessary waste of Network / SQL-Server recources.

Can someone explain this, pls? And: What can we do to get only the wanted columns?

Regards Frank

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 18-Dec-2014 17:35:01   

PK & FK fields are always fetched. Do you have fields that are neither PK nor FK, and still are fetched? In this case could you please provide the LLBLGen Pro runtime library version (build no.) that you are using?

dm.Frank
User
Posts: 21
Joined: 26-Apr-2013
# Posted on: 18-Dec-2014 18:09:58   

As you can see in the above SQL there will be fetched all fields. PK field ist AdresseId. FK field are AnredeAppAuswahllisteEintragId, LandId.

SD.LLBLGen.Pro.DQE.SqlServer.dll -> 4.0.13.0406 SD.LLBLGen.Pro.ORMSupportClasses.dll -> 4.0.13.0411

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 19-Dec-2014 07:03:41   

I'm not sure, but I think you are putting the fieldsAdresse variable in the wrong node, as I think that the addresses is the last node (MandantEntity.PrefetchPathAdresse) and not the first one (ArztEntity.PrefetchPathArztMandanten).

Your actual fetch path looks like this:

ArztEntity -> ArztMandanten -> Mandant -> Adresse

...and you are passing the includeFieldList into the ArztMandanten node, which I guess it's not of type Addresse. If you examine all the generated sql queries, you will notice that the ArztMandanten fetch query is the one that is actually retrieving just the PK/FK fields, and that is expected, as no ArztMandanten fields match your includeField list.

So try this instead:

prefetch.Add(ArztEntity.PrefetchPathArztMandanten, 0, predicate)
     .SubPath.Add(ArztMandantEntity.PrefetchPathMandant)
          .SubPath.Add(MandantEntity.PrefetchPathAdresse, fieldsAdresse);
David Elizondo | LLBLGen Support Team
dm.Frank
User
Posts: 21
Joined: 26-Apr-2013
# Posted on: 19-Dec-2014 14:43:02   

That's it. Thank you.