Refreshing entitycollection with only prefetch paths

Posts   
 
    
pat
User
Posts: 215
Joined: 02-Mar-2006
# Posted on: 03-Feb-2009 04:24:16   

Hi,

I've got a EntityCollection<Customers> already in memory..

Now I want to only load the missing prefetch paths without fetching the customers again... Is this possible?

I'm using the Adapter template.

Thanks, Patrick

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 03-Feb-2009 09:59:07   

Althought I'd recommend saving the trouble and re-fetch the entire graph as you did the first time, I don't think it would hurt if you fetch the Customers if you are going all other related collections.

But anyway you can add the entire graph into a Context, and then refetch each related collection which update the entities (collections) in the Context.

pat
User
Posts: 215
Joined: 02-Mar-2006
# Posted on: 03-Feb-2009 19:04:57   

Walaa wrote:

But anyway you can add the entire graph into a Context, and then refetch each related collection which update the entities (collections) in the Context.

How would this work please? It look like it might turn out to be quite complicated if I have a collection of customers and want to load all the orders etc for each.

Maybe it is better to just load them all again.

Thanks, Patrick

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 03-Feb-2009 21:20:36   

I'm with Walaa on this one - if you have a large number of customers and you need to load the orders for each one, it implies that you may be better of flattening the structure and pulling back the information as a Typed List, assuming it is for display purposes only.

If you do need to edit a customer and his related orders, just load the whole lot in one go - you can load very large graphs in LLBLGen without any significant performance penalty - I frequently do 7 level graphs with many related entites (total into the 1000s) in less than 1 second (assuming your DB server is up to the job)

If you do want to investigate the Context, the documentation is here

Matt

pat
User
Posts: 215
Joined: 02-Mar-2006
# Posted on: 05-Feb-2009 20:31:09   

Ok thanks I'll go the reloading route even though it doesn't sound like the most effective way of doing it...

It really a pity LLBLGen has no caching build in or an extension which would make it easy to make our own transparent caching...

Thanks, Patrick