This project has moved and is read-only. For the latest updates, please go here.

pre populated database

Feb 10, 2011 at 10:10 PM

I have a wp7 app that parses some large xml files into objects(books) every time the app loads. So I decided to use sterling to write these books to a database so I wouldn't need to load them each time.

The problem is, it can take upwards of 10 minutes to parse these books and then write them to the database, which is not a very good user experience.

Would it be possible to just generate these db files in my emulator, and then grab these files and ship them with my app so the db is pre populated? 

I know I could use backup/restore to do this, but copying the generated db files seems much easier. Thanks for your help.

Feb 11, 2011 at 2:49 AM

The restore function does exactly what you are referring to. It basically parses the files and data, and writes them out.

In order for you to do it, you could just package the files are write them directly to isolated storage. The file storage format is shared in the user's guide at - but again, you'd be duplicating what the restore function does.

Easiest would be to call the backup, store the data, and embed that, then detect if the database is populated and if not, restore on the stream.