Mark entity hierarchy as new - fairly urgent

Posts   
 
    
oldtimer
User
Posts: 1
Joined: 01-Feb-2006
# Posted on: 01-Feb-2006 01:59:57   

Hello,

We're having difficulty using serialization with the entities that are to be cloned (in memory or to a file) and then saved as new ones.

The basic scenario is as follows: 1) An entity E and its 2 child collections ColA and ColB are fetched from the database using E's prefetch paths for ColA and ColB. 2) E is serialized (either xml or binary) ... something is done to the serialized file ... 3) E is deserialized recursively 4) We mark E's fields as changed (except for PK) 5) We try to go through the E's relationships for ColA and ColB to mark entities in the collections as new and their fields as changed but this (since it's self-servicing) triggers database calls, which in some cases (for example when saving deserialized data to a different DB) causes problems b/c in addition to the deserialized data in the collections we also have whatever matched the PK-FK relationship in the "other" DB.

Is there a way to avoid this "lazy fetch" somehow or is there a different approach? We tried using GetMembershipCollections in order to traverse those, but this did not produce new entities.

In fact, we're not even sure, why the fetch is necessary b/c the entity state in the serialized data is "Fetched" for all members of the collections in ColA and ColBconfused

Any input appreciated.

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 01-Feb-2006 03:03:08   

Could you post some code from the traversals. That would help with suggesting a solution to see a better example of how this is being implemented. Thanks.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39930
Joined: 17-Aug-2003
# Posted on: 01-Feb-2006 09:31:18   

Also please post the runtime library version you're working with. Rightmousebutton on sd.llblgen.pro.ormsupportclasses.net11.dll in explorer -> version tab.

Frans Bouma | Lead developer LLBLGen Pro