Forum Xamarin
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Best Practice for Updating local DB with Data from Server

spxam007spxam007 Member ✭✭
edited October 15 in Xamarin

I am new to Xamarin, and I would like to know what the best practice would be for creating/updating data in my local database to simulate my server tables. I have not coded this portion yet, and I am really just looking for guidance.

My App when first opened should retrieve all data from my server and insert all that data to my local tables. I am almost duplicating the tables/data/column names from my server so that I don't have to make API call throughout my app and just pull that data locally.

As the user continues to use the app, my plan is to keep track of when this data gets updated (a timestamp) then pass that timestamp to my server and see if any new/ updated data happened after that timestamp. If changes have been made then I will only pull the updated information(which I will be doing in PHP).

I think up until here I have my process down, but please feel free to correct me. Now when it comes to bringing that new, updated or deleted data I am confused how to format that to send to xamarin. I have seen in android Apps where they call a web service and that returns a xml file, JSON format or a db file which either returns the data to then parse and either insert, update or delete, or sqlite queries with the data in loops to execute.
Like:
"UPDATE tblPerson ...."
"DELETE from...."
If any of these options are possible which would be the best choice to run when the app is opened. Keep in mind I first check the last time information was updated, if no information has changed since that date I would just skip this step.
I really want to plan this out before I begin coding.

Tagged:
Sign In or Register to comment.