I have an app where we used azure mobile service to store and retireve data from/to azure. We also used Blob storage to store images and videos on cloud.
Now we want to support offline mode as well in our app, and so i went through the azure mobile service offline sync mechanism. so, What I am thinking is to handle the situation in following manner:
Create an interface for Upload (Push async)
Create an interface for download (Pull Async)
Putting everything in one place or define a each class/interface for sync mechanism? ex. I have 6-7 tables in database for which should i create a different interface/class or wrap everything in one interface/class with a method like DownloadData or UploadData?
Also, for storing picture and videos on blob storage, i have created a static method with Task.Factory.StartNew in one class to run it in background which upload pictures and video to blob storage. From this method i am calling another method called "TryOfflineSync()" which is also having Task.Factory.StartNew which simply uses Pull and PushAsync method of Azure mobile service to get data from local db to server and vice-a-versa.
Also get frequent “Push operation failed
” error due to some violation in primary key, however we maintained it from our side that whenever we create a new records, we create new Guid which is an “ID” field in all of our tables.
Also I tried to remove the Task.Factory.StartNew from the method, but then the PushAsync is not working properly Meaning i have 12 pending operation but they are not pushing to server. and pull is also failed in that case.
so any one know a mechanism from which one can manage sync operation properly?