1
votes

Here are a few details in my current setup to keep in mind for this discussion to be meaningful.

Client App: Xamarin Forms app, uses Azure offline Sync

Web Access: There is a Asp.Net based web front end that also accesses the Mobile Service to read/ write data to the underlying tables

Backend: Managed dot net based App Service hosted on Azure

My Question: As of now I pass a null value to Incremental Sync parameter to ignore any incremental sync (while using PullAsync method) & get all data from the server. This however is inefficient as it increases the load time as the volume of data increases.

If I use a constant value for Incremental Sync parameter for the table under consideration, this is what it does

Each time a pull operation returns a set of results, the latest updatedAt timestamp from that result set is stored in the SDK local system tables. Subsequent pull operations will only retrieve records after that timestamp.

as read here

The problem is, my web access also updates the data from web & it also uses Azure App service framework to do that. In this case, if I use the incremental sync parameter do a Pull of data, then there is a change on the data from the web app & if the mobile app again does a Push, Pull.. will it get the latest changes from the web too?

My understanding is that incremental sync only works with the data the context is aware of, but in this case because the web app is also writing the data, which the context is not aware of, then it misses some of the data & the mobile app never downloads it.

Is there a way to fix this behavior? So I can start using incremental sync & still be able to ensure that the app always gets all the data from server without missing any bits?

Update:

@Adrian it's not working for me. May be because the way my Tables are structured, or the way i am dealing with them is not correct.

I have a User Table & a Department Table, I also have a UserDepartment Table.

When I sync the app, the data in this UserDepartment Table gets duplicated on the app.

The reason could be because, when I edit the user on web to assign departments to them, I delete all previous User Department entries from UD table & recreate new ones based on current selection. Do you think this could be causing issues with azure client SDK & thus duplicating some data for me?

1
Did u find the solution for this question?Anas Alweish
yep, my problem was exactly the same as I stated in my Edit above. rather than updating the records properly, we were deleting & re-adding them.Supreet

1 Answers

0
votes

If your web app and mobile app update through the same Mobile App API (i.e. using the .NET SDK and JS SDK respectively), then the updatedAt is set appropriately for both pushes and the other side should pick up the change. I've done this myself several times and it works.

One the web side (using the JS sdk), you just use an online table. On the mobile side (with the .NET SDK), you use incremental sync.