W7Phone and IsolatedStorage

Jul 11, 2011 at 3:24 PM

I seem to be missing a fundamental step somewhere. Do I need to explicitly store the database content to isolated storage myself or does the engine do this for me?

The app follows the _ActivateEngine/_DecactivateEngine pattern. The database returns the correct key value after a Save() and a query like this returns the values as I would expect when using Query() but the saved content is not persisting acorss new instances of the application.

Thanks for any help.

Puzzled.

Coordinator
Jul 11, 2011 at 7:33 PM

Most common mistake is initializing the databsae without passing in an isolated storage driver. Pass in a new IsolatedStorageDriver() as per this page: http://www.sterlingdatabase.com/sterling-user-guide/getting-started

Jul 12, 2011 at 1:15 AM
Edited Jul 12, 2011 at 1:18 AM

I'm having a similar problem.  I have this in my ActivateEngine method:

 _engine = new SterlingEngine();
 _logger = new SterlingDefaultLogger(SterlingLogLevel.Information);
 _engine.Activate();
 _database = _engine.SterlingDatabase.RegisterDatabase<DatabaseInstance>(new IsolatedStorageDriver());

 

  

This is what my save code looks like (the table will only have a single record): 

 var am = App.Database.Load<AppModel>(true);
  if (am == null)
     am = new AppModel();

  am.IntialInstallComplete = true;
  App.Database.Save(am);

 

If I Load() the record after saving it exists, but not when I reload my app. Seems like its still using the MemoryDriver and not the IsolatedStorageDriver. Any ideas???

Jul 12, 2011 at 10:50 AM

Jeremy,

Many thanks.

I am still confused by the cleanup example: Where does PathProvider.BASE come from?

Jerry.

Coordinator
Jul 12, 2011 at 1:19 PM

Best way to be sure is to take a look at the tests that ship with the source. We run all tests and make sure they are green before shipping a version, so the code examples in the unit tests should be accurate.