Deploying XML or db files

Oct 14, 2010 at 1:07 PM

I just realized the database is simply a bunch of xml files that are stored in isolated storage using Namespace.EntityName format for each table.

My question is how do I packaged the database with my application for deployment.  Right now, I can packaged the XML files, then create the database and tables from the XML files the first time the application runs.  

The problem is that I am using twice the space.  My XML files are about 5 MBs, so I will be using 10Mbs instead, since I will have the XML files packaged as content and then the app will create the database files in isolated storage.

There has to be a better way to do this!!!

I tried naming my xml files the same names as the db files and used the same XML schema but the database couldn't pick them up because it was looking for them in isolate storage and not in the application root folder.

Is this making any sense?  I don't mind contributing to your application, just point me in the right direction.


Oct 14, 2010 at 7:28 PM

If you include those files with your app, you are using the driver space no matter what.  There is nothing you can do to unhook those files from your app.  The clean solution is to have your app download those from the internet upon fist start.  Even if you real DB (not supported on the phone) - you would have had the same problem.  5 MB is not that big a deal anyway.  As part of download you will get a sample on how to do this properly to make sure your app does not load your preloaded data into memory, if that is your concern.

 Just let me know what you think.



Oct 14, 2010 at 7:37 PM

What if it is 50MB or 100MB then I am doubling my storage and using a web service is not that efficient...

Is it possible for the database to read its files directly from my app folder e.g. /db/[db files] ?  Or does it have to use isolated storage?

Do you know if WP7 has compression support?  If I can zip my initial xml data to reasonable size then on first run uncompress it and initialize the database then that could be a workaround.  Not the best workaround but it is something...

Oct 14, 2010 at 7:49 PM

You cannot touch application folders - that is my understanding.  Your app is essentially read only package, and you do not know where it is exactly on "hard drive".  I have not looked into compression yet.  I think your app can be very large, although having 100 MB DB on the phone is not going to work for you - the device is not powerful enough. I think if you are concerned with space, you might conceder going web service route. I personally would not be concerned with 10 MB.



Oct 14, 2010 at 9:15 PM

It looks like a hybrid local + web service is the way to go.  I will probably have a small part of my database deployed with my app and then load more records from a web service on demand.  Otherwise, it will just get too big.


Oct 14, 2010 at 9:29 PM

I agree that what you came up with is the best approach.