Adapter , fetching entities separately

Posts   
 
    
rracer99
User
Posts: 58
Joined: 11-Mar-2007
# Posted on: 08-Mar-2010 10:31:10   

Hello,

If I have the following relationship and prefetch path:

(orderEntityObj) Order -> Order Item -> Subscription Relation

(customerEntityObj) Customer -> Subscription Relation -> Order Item -> Order

And I retrieve these entities in two separate calls via adapter,

And make a couple edits:

orderEntityObj.OrderItemCollection[0].Discount = xxx; customerEntityObj.SubscriptionRelation[0].DateExpires = xxx;

And assign one object to another , even though these collections were retrieved separately:

orderEntityObj.OrderItemCollection[0].SubscriptionRelation = customerEntityObj.SubscriptionRelation[0];

What will happen here ? :

adapter.SaveEntity(orderEntityObj, true, true) ;

Will orderEntityObj.OrderItemCollection[0].Discount be updated? Will orderEntityObj.OrderItemCollection[0].SubscriptionRelation.DateExpires be updated? Will customerEntityObj.SubscriptionRelation[0].DateExpires be updated?

Is LLBLGEN using references to the redundant data in these collections?

We have complex relationship with many tables and many different use-cases. We will be retrieving entities with several dimensions of prefetch paths, in different directions. I want to know if we can connect entities in the way described above and if LLBLGEN is allocating memory for the redundant data sets.

Thank you!

Walaa avatar
Walaa
Support Team
Posts: 14994
Joined: 21-Aug-2005
# Posted on: 08-Mar-2010 14:14:07   

Yes, connecting entities should work (the way you have described it).

Retrieving 2 objects from 2 different db calls, will lead to 2 instances in memory. To avoid this you should use a Context