sequence of the save() function

Jan 21, 2012 at 4:51 PM


Thanks for the DB. Since the Mango release I have an issue with the save method. My application is retrieving some data from the internet in a backgroundworker and saves it to the db, and saves the database.

While it could sometimes take some time to retrieve the data (slow respond) it sometimes occurs the background worker got killed by the OS within the save function. Due to the fact, the save function is deleting / recreating the db file, it might sometimes result in a lost of all data.

any suggestions? (i'm using the synchronious save() function). I'm not sure about the wp7 threading model, but will the async save be an option??


Jan 22, 2012 at 12:25 AM

Async save functionality is available, but I do not think it will solve your problem. You only have a few seconds to update and save the data, and if you have slow internet response, you can always end up in trouble. What I would suggest is to use agents available in Mango. They have more time to deal with possible issues, such as slow internet connection. My suggestion would be to use periodic tasks and chunk up the data to ensure that you task completes and will not get killed while it is running. In addition to that, you can consider partitioning your large tables via table names functionality. Smaller tables will result in faster saves. I know, it is a lot of work, but I do not think there is a quick solution for you. You can also consider moving to SQL CE on Mango, which will likely perform better than my database, but I think you will still have to take steps to avoid long running tasks.