Prefetch question

Posts   
 
    
hypo
User
Posts: 34
Joined: 14-Oct-2008
# Posted on: 04-Nov-2008 21:27:59   

Hi all,

I'm wondering how to do the following:

Lets say I have Orders and OrderLines. But I don't want to prefetch everything from the first time (in this example it seems stupid, but in the project I'm working on, it can go 4 levels deep).

**How can I fetch the OrderLines later on, when I already have the order. ** Could someone provide an example about this? Or guide me on how to do it?

I'm using Adapter.

(Something like: OrderEntityInstance.Prefetch(OrderLines) would be awsome smile )

Kind regards, Wim

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 04-Nov-2008 21:57:54   

You can fetch a collection when needed as follows


adapter.FetchEntityCollection(OrderEntityInstance.OrderLines, OrderEntityInstance.GetRelationInfoOrderLines())

It does kinda defeat the point of using adapter though simple_smile I regularly pre-fetch 6 level deep hierarchies with all sorts of branches in the graph, sometimes containing thousands of objects without any real performance penalty.

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 05-Nov-2008 08:24:47   

For reference, check the following manual section: Entity retrieval into an entity collection object using a related entity

hypo
User
Posts: 34
Joined: 14-Oct-2008
# Posted on: 05-Nov-2008 10:16:59   

Thanks guys, That's what I was looking for wink