Joining/merging prefetch paths

Posts   
 
    
Posts: 12
Joined: 29-May-2007
# Posted on: 26-Mar-2010 10:59:37   

Hi,

I am using LLBLGen Pro 2.6 (adapter) and I'm trying to find the best solution to 'join' two prefetch paths (IPrefetchPath2 instances), in a generic way.

Am example: let's say that I have one method which returns a prefetch path for an Order entity, like this: Order-->Customer |-->OrderLines-->Product-->Company

and another method which returns a prefetch for a Customer entity:

Customer-->City-->Country |-->Company

and I want to build a prefetch paths which contains these 2 prefetch paths, "joined" on the common "junction point", which is Customer.

To put it in a more generic way, we have two graphs (or trees?), and I have to connect the "root" node of the second one, to all leaf nodes with the same type, from the first graph.

My questions are: has anybody else encountered this problem? Is there a best/recommended approach for a generic solution? What possible problems could occur is the 2 graphs have common nodes (ex.: Company in this example).

Walaa avatar
Walaa
Support Team
Posts: 14994
Joined: 21-Aug-2005
# Posted on: 26-Mar-2010 12:11:25   

You can recursively loop on PrefetchPath Elements in hand and their subpaths' elements for the required RetrievalCollection.EntityFactoryToUse.

Posts: 12
Joined: 29-May-2007
# Posted on: 26-Mar-2010 12:43:37   

Thanks!

Woudn't be enough if I compare prefetchPathElement.ToFetchEntityType with path.RootEntityType ?

Walaa avatar
Walaa
Support Team
Posts: 14994
Joined: 21-Aug-2005
# Posted on: 26-Mar-2010 20:04:11   

Sure. I've missed that. You are correct.