OfflineDataSync SyncUnits and Multiple entities

Hello fellow developers!

I'm wondering how the offline data sync with SyncUnits should be implemented according to the Outsystems best-practices. I've taken a look at the following documentation of Outsystems and got some questions regarding the OfflineDataSync that involves multiple Entities and SyncUnits.

Background information: (Only an example..)

Lets say we have a mobile application, that contains an overview of Products and SalesPersons. The datamodel looks like this:

* The server data model contains the same entities as the local data model.

Next, we create (auto generate) the sync actions for the 3 entities mentioned above:

Those actions look like this:

Now to implement this in the OfflineDataSync. I believe the following needs to be done:

  1. In the OfflineDataSync action we add a switch, that depending on the SyncUnit executes specific logic.
  2. We create a switch path 'AllEntities' and drag-and-drop all auto-generated client actions into this path.
  3. We create a new switch path 'SalesPersons' that sync only the SalesPerson entity. (we would like to execute this in other occasions, where we don't want to sync the other entities for example...)

*The OfflineDataSync client action is executed by running the 'TriggerOfflineDataSync' in the relevant overview in the mobile application. (pull-to-refresh). ProductOverview page triggers the SyncUnit 'AllEntities'. While the SalesPersonOverview triggers SyncUnit 'SalesPersons'.

Now I've got the following questions regarding the implementation above:

  1. Is this the right implementation? Wondering since I can't really find more documentation on how to implement the SyncUnits.
  2. Each client action that syncs 1 entity now does 1 call to the server. Is this a bad-practice? Since in the 'AllEntities' SyncUnit we now have in total 3 server actions. If this is a bad-practice, how should this be done otherwise?
  3. Optional: I'm wondering if someone has an idea on how to do this in batches, this might apply for the ProductImage entity, since this contains binary data that may slow down the sync a lot. I believe syncing in batches would be the solution. (read-only-optimized pattern, might not really apply for this, since the first sync always has all the data..). 
    1. If someone has an example (maybe in an .OML) on how they solved this issue on their project.



Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.