views:

141

answers:

1

I want to persist objects into Isolated Storage, so far I could think of these ways:

  1. Serialize them into an xml file when saving and then serialize them back when saving.
  2. Use an Object DB. Doubt abounds about a good or recommended one (Examples are Perst, winphone7db and Sterling DB)

Anyone can suggest some best practices?

+1  A: 

As a basic guideline:

If you need the functionality of a database (relations, transactions, search, etc.) then you should use a database.

If you just need an object store, then you should just save your objects into Isolated Storage directly (serialising where necessary).

I haven't used each of the different DB options available but would probably go with Perst as it's the most established (there's also a good guide here), winphone7db is also not available yet.

Matt Lacey
Seconded. I've got two apps that have a very simple two or three "table" approach, and I'm just serialising objects and using linq.Add http://www.db4o.com/ to your list of database options. I've not used it, but heard good things about it.
Ben Gracewood
@Ben How do you go about serialising yoru objects?
Ben McCormack
I'm just storing them as properties on a singleton Database object. The Database class has load and save methods that use XmlSerializer to save and load the private fields.
Ben Gracewood