在 Windows Phone 7 上将数据持久化到独立存储的最佳方式是什么? [英] Whats the best way of persisting data to Isolated Storage on Windows Phone 7?
问题描述
我想将对象持久化到独立存储中,到目前为止我可以想到这些方法:
- 保存时将它们序列化为一个 xml 文件,然后在保存时将它们序列化回来.
- 使用对象数据库.关于好的或推荐的有很多怀疑(例如 Perst、winphone7db 和 Sterling DB)
有人可以推荐一些最佳做法吗?
作为基本准则:
如果您需要数据库的功能(关系、事务、搜索等),那么您应该使用数据库.
如果您只需要一个对象存储,那么您应该直接将对象保存到独立存储中(必要时进行序列化).
我没有使用过每个可用的不同数据库选项,但可能会使用 Perst,因为它是最成熟的(还有一个很好的指南 此处),winphone7db 也不可用.>
I want to persist objects into Isolated Storage, so far I could think of these ways:
- Serialize them into an xml file when saving and then serialize them back when saving.
- 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?
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.
这篇关于在 Windows Phone 7 上将数据持久化到独立存储的最佳方式是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!