Using Aurelius for replication

Hi,



I am using Aurelius to sync a mobile device with my backoffice. I have Datasnap server that can be queried for Objects that I send to the client using the serializing\deserializing technique from Aurelius.



This all works very simpel and seems a very effective way of syncing a mobile db with with my backoffice DB. But getting the fetched objects which are transient for the client objectmanager to be saved seems a bit complicated.



I do something like

       clientObj := ClientObjectManager.Find<TMyObject>(TMappingExplorer.DefaultInstance.GetIdValue(MyObject));

       if clientObj<>nil then

        ClientObjectManager.Merge<TMyObject>(MyObject) else

        ClientObjectManager.Save(MyObject);

      ClientObjectManager.flush;



This works well, but when the object has associations then these don't get saved. I tried a second class that has the associations as normal fields, and I then sync this mirror class. this seems to work but then I have to do all the cascading class references myself.



Is there a technique I can use to do this "replication"? I saw some methods in Objectmanager: ReplaceAssociations, is that something I could use?

I found a way to perform a good replication\synchronisation between my Mobileclient en backoffice. Though I had to implement a new descending ObjectManager that uses the FObjects variable. For now I altered your Aurelius.Engine.Objectmanager unit to make the FObjects variable protected. Could you make this protected in your code as well?



Hello Kick,

about your first question, it seems to be that if you have both merge and saveupdate cascade defined in your associations, everything would work smoothly?
Nevertheless, I was thinking about including a replication system in Aurelius for a while. I would like to hear from you your ideas so the final solution would have more use cases. If you are interested, please send me a private e-mail (just send to tms support) so we can discuss, thank you.