Clarification Needed about Offline Sync Logic

Clarification Needed about Offline Sync Logic

  

The following image explains the question: http://screencast.com/t/C2WSNmqe
This is from the v10 mobile app course.

ServerDataSync includes assignment of server aggregates into local storage entities. But, within the client's OfflineDataSync logic, it is then followed by clearing all local storage and creating/updating operations for all local entities.

Where can I find an explanation for why the sequence is implemented that way?

Solution

Hi Ido,

The server action "ServerDataSync" isn't loading the data into local storage entities. What it does is to fetch the data from the database and assign it to the output parameters (LocalCategories, LocalPriorities, etc), so that it becomes available to whoever is calling the action.

So after calling the server action and having all the necessary data from the server available, the "OfflineDataSync" client action proceeds to clear all local data, replacing it with the server data.

I hope that clarifies it.

Solution

Thanks!  The reason for confusion is that the course gave output parameters the same names as local entities.

Hi Ido,

Converting the server records to the local records while in the server is a best practice, as it ensures that only the necessary data is sent from the server to the client.

Regards,

Paulo Ferreira

The cause for the confusion was not the logic -- it was the naming of output parameters exactly as the names of local storage entities.