XML 文件持久性的 LINQ to SQL 等效项
Microsoft 通过 LINQ to SQL 映射使保存对象变得非常容易。
然而,有时我想要更轻量级的东西,即能够在应用程序关闭时将对象保存到文件中,然后再次读回它们。 XML 看起来像是一种自然的数据格式,而不是发明一种新的数据格式。 (当然,有人可能会说 XML 是新的 ascii,并且我们仍然存在定义数据模式等问题......)。
是否有预定义的方法来执行此操作,或者我是否必须手动找出 XML 数据格式并编写例程来读/写它们,即通过构造 DOM 等效项然后另存为 XML?
Microsoft has made saving objects very easy with their LINQ to SQL mapping.
However, I would sometimes like something a little more lightweight, i.e. the ability to save objects to a file when an application closes, and read them back in again. XML seems like a natural data format rather than inventing a new data format. (Of course, one could argue that XML is the new ascii, and we still have the problem of defining the data schema etc. ..).
Is there a predefined method of doing this, or am I going to have to manually figure out an XML data format and write routines to read/write them, i.e. by constructing a DOM equivalent and then saving as XML?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如何处理 数据集 和 < a href="http://msdn.microsoft.com/en-us/library/system.data.datatable.aspx" rel="nofollow noreferrer">DataTables 等 - 然后 将它们序列化为 XML?
How about working with your data in DataSets and DataTables, etc - then serializing them as XML?