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

My ReadOnly WP7 senario...

Apr 30, 2011 at 8:14 PM

I need to:

  1. Define and populate a Sterling db (~25k records across 5 tables)
  2. Save the db to a file and included as an embedded resource in a WP7 application
  3. On the first launch of the WP7 app, save the db from the assembly to isolated storage.
  4. Search the db from the WP7 app (read only, never written to by the app)

Can the db be compressed/zipped when added as a resource, and then unzipped when saved to isolted storage?

How do I get it to local storage? Save the file to local storage and point Sterling at it, or load it into Sterling and let it save to isolated storage?







May 1, 2011 at 1:30 AM

Ok... getting closer:

I found this:
but I don't understand how to get the physical file that Sterling saves to isolated storage, when I am running a SL4 app.

Next, how will the wp7 app open it? Will it open from the assembly, and 'save' to isolated storage, or do I copy the file somehow to isolated storage and tell Sterling to open it there?

right now I am working out the issue where when I reach a point adding records, isolated storage says it is out of space.


May 1, 2011 at 2:08 AM

Roger, all of those steps are covered in the example with the source.

If you run the database generator program, it shows the function of populating the database (in this case, it simply churns through the CSV files for the database and calls it). Because it's only purpose is to generate the database image, it does not use isolated storage but just builds in memory (far faster). When done, you simply call the "backup" method and pass it a save file dialog. This will save a stream to disk based on whatever name you provide. This is a Sterling back up image.

The actual example program that allows you to query the nutrients then shows the way to restore it. The resource is simply added to the project as an embedded resource, and opened in a stream. The stream is then passed to the "restore" command for the database, with a callback that is called when the restore is complete. The database is shut down and restarted and then you are in business and it is on the isolated storage of the target device.

May 1, 2011 at 7:10 PM

Yes, I see that, thanks. However, I may be confused, but I want a slight variation of that:

Rather than consuming csv files, I want to take the actual physical file that is the result of a database saving it's self to local storage. Take that file and imbed it in the wp7 assembly. Copy from the assembly to local storage on first run. Then open from local storage on subsequent runs.

I want the consumption of the data to the database to happen before it ships.