tags:

views:

193

answers:

1

I start with an entity A with primary key A1, it has child collections B and C, but they are empty, because I haven't prefetched them. I now get a new occurrence of A (A prime) with primary key A1 with the child collections B and C filled.

What is a good way to get the A and A prime to be the same object and to get A collections of B and C filled?

+2  A: 

Once you, have 2 separate objects in memory and you have references to both of them the only way to merge them is to change all references to point to one of the objects, which might be impossible. However there's something you can do not to arrive in this situation you can use a SD.LLBLGen.Pro.ORMSupportClasses.Context class which you can attach to an adapter and which acts as a caching layer and when entities are loaded it returns the same object for a unique entity, basically it does't let you duplicate entities in memory and always returns the reference to a already loaded entity.

Pop Catalin