New Posts New Posts RSS Feed: Synchronizing Entities
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Synchronizing Entities

 Post Reply Post Reply
Author
gregweb View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 10-Sep-2009
Location: Clearwater, Fl
Posts: 253
Post Options Post Options   Quote gregweb Quote  Post ReplyReply Direct Link To This Post Topic: Synchronizing Entities
    Posted: 17-Jun-2011 at 7:52pm
I have an interesting scenerio where an entity goes from the client, up to the server, is modified there (and saved to the database) and then comes back to the client.
 
The issue is that on the client, I now have two nearly identical entities; they are out of synch.  The first entity is in use, so I can't just remove it and replace it with the new instance.  The only solution I have come up with is to manually synch the changed properties, but I was wondering if there was any other guidance.
 
Greg
Back to Top
robertg View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 15-Mar-2011
Location: California
Posts: 87
Post Options Post Options   Quote robertg Quote  Post ReplyReply Direct Link To This Post Posted: 20-Jun-2011 at 10:19am
Greg,
 
This sounds like a very interesting and strange problem. Is your entity in the client detached, or what? I don't understand why it would be a seperate entity from the one on the server. Would it be possible to make that entity a part of your EM in the first place, so you can keep it up to date with whatever changes you've made on the server by using a DataSourceThenCache merge strategy, which will overwrite the client-side version of the data with whatever is retrieved from the server-side?
 
Yours,
Robert
Back to Top
gregweb View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 10-Sep-2009
Location: Clearwater, Fl
Posts: 253
Post Options Post Options   Quote gregweb Quote  Post ReplyReply Direct Link To This Post Posted: 21-Jun-2011 at 6:14am
Hi Robert,
 
Let me try to explain a bit better. 
 
On the client, I have an entity called EmailFolder.  I take this an pass it up to the Server and do some processing there to get new email.  One of the properties is called NumberOfNewEmails.  I set this property while on the server.  I then pass back the entire entity to the Client so that I know the number of new Emails.  Here is where the problem resides.  I can't add it back into the EntityManager as the original is already in the EntityManager so my only choice is to find the original and update the NumberOfNewEmails property using the copy.
 
In any case, don't worry about this too much, I got this working well enough to move along!
 
Greg
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down