Is there a way to transfer persistent objects between OpenAccessContext

321 views Asked by At

Is there a way in telerik openaccess to copy an object from one OpenAccessContext to another?

I tried the following (ugly) approach: Take an object of one context, serialize it, deserialize and then put it in another context.

I cannot believe that there is no build in method to just clone an object. Does anyone know a better way? (and i do not mean: copy using reflection)

2

There are 2 answers

4
Damyan Bogoev On

You could use the Attach / Detach functionality of OpenAccess ORM to handle this scenario.

0
Ivailo On

Have you used the old ObjectContainer approach, available in the Classic API or the latest OpenAccessContext.CreateDetachedCopy + OpenAccessContext.AttachCopy functionality? I am wondering which one has caused the troubles