Answered by:
Fetching data from WebService in bacground and update th UI in WinRT application

Question
-
Dear all,
I need to build an application which will display a list of product information collected from a CMS on internet.
In our desktop version of this application we were building a separate process which collect all data from CMS configuration and store them locally in an SQL express database, then the application will have all data ready for use once the sync operation is completed.
Now that scenario in a mobile device seems a bit more complex and would like to know your advise on how to approach this.
For instance, I could do the same and donwload all data in a local SQLite database, then once complete, the UI can display the information. By doing so in a mobile app, I am a bit worried because if the sync and write to db process takes long time the UI could not perform anything during that time as it has no data to show.
Second option would be do deal to live web service, but then if for some reason connection drop, app will get stuck and data either partially downloaded.
For exemple, products are organise in categories and subcategories for beeing able to use filter based product. Then product are based on text description and pictures. In such case in order to be able to show the filter on the UI I should have the list of category and sub category available, but then if they are available user is able to use the filter, but product data mihgt not have been donwloaded yet or not fully.
So get really confused on proper way to go and decide if I should collect data on demand based on live web service, or if I should download all data to database, or a mix of both but how?
thanks for your advise
regards
Thursday, April 9, 2015 8:16 AM
Answers
-
Those questions require detailed analysis of your use case, which I don't have and really don't want to get into. I don't imagine that your scalability needs for this app are so severe that a though examination of every type of caching mechanism is necessary. I suggest that you start working on your app with a web service back end, figure out where the bottlenecks are in terms of app responsiveness/data usage, and then work on resolving those issues.
Matt Small - Microsoft Escalation Engineer - Forum Moderator
If my reply answers your question, please mark this post as answered.
NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.- Marked as answer by wakefun Thursday, April 9, 2015 3:50 PM
Thursday, April 9, 2015 3:10 PMModerator
All replies
-
IMHO you should use a WebService. It's far less work to set this up and no syncing required. YOu can also implement some sort of caching so that the local database retains information that has been previously downloaded so you don't have to retrieve it again.
Matt Small - Microsoft Escalation Engineer - Forum Moderator
If my reply answers your question, please mark this post as answered.
NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.Thursday, April 9, 2015 1:05 PMModerator -
THnaks for your reply.
What type of caching should I store in database according to your experience ?
For exemple a Product is based on :
- Name,ID,Title,Description,PictureURL
Once this product has been downloaded and use once trough web service, ok I store it in database but in which form ?
- Complete serialized object ?
- in same table structure as in the web CMS database ?I would need to handle I guess a kind of cache time somehow
regards
Thursday, April 9, 2015 2:14 PM -
Those questions require detailed analysis of your use case, which I don't have and really don't want to get into. I don't imagine that your scalability needs for this app are so severe that a though examination of every type of caching mechanism is necessary. I suggest that you start working on your app with a web service back end, figure out where the bottlenecks are in terms of app responsiveness/data usage, and then work on resolving those issues.
Matt Small - Microsoft Escalation Engineer - Forum Moderator
If my reply answers your question, please mark this post as answered.
NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.- Marked as answer by wakefun Thursday, April 9, 2015 3:50 PM
Thursday, April 9, 2015 3:10 PMModerator