在.Net应用程序中保存/加载大量数据的最佳方法? [英] Best way to save/load large amout of data in a .Net application?
问题描述
为.Net 4.0应用程序保存大量数据的最佳方法是什么?
What is the best way to save large amount of data for a .Net 4.0 application?
现在我正在使用列表并序列化到用户数据"文件夹中的文件,它的工作正常,但是我想知道是否有更好/更快的方式来保存/加载大量数据.
Right now I am using Lists and serializing to a file in "User Data" folder, and its working ok, but I want to know if there is a better/faster way of saving/loading large amount of data.
我要保存的数据仅包含大量单词,例如文档.
The data that I am saving contains only lots of words, like documents.
数据大小几乎为1 mb.
The size of the data is almost 1 mb.
推荐答案
这实际上取决于您的应用程序的类型.我不会使用任何形式的SQL数据库来加载和保存不需要查询或转换的数据操作.将您的对象图映射到关系模型所花费的时间并不值得.另外,由于与数据库相关的开销(连接管理和映射),我不认为它会比简单的序列化更快.
That really depends on the type of your application. I wouldn't use SQL database of any sort for to just load and save operation of data that I do not need to query or transform. The time it will take to map your object graph to a relational model just not worth it. Also I don't believe it will ever be faster than simple serialization due to the overhead associated with databases (connection management and mapping)
我最近的经验是在BinnaryFormatter上获得了出色的结果(文件〜15mb).更糟的是,您总是可以编写自己的格式化程序.
My recent experience was with BinnaryFormatter which had excellent results (files ~ 15mb). Worse come to worse you can always write your own formatter.
这篇关于在.Net应用程序中保存/加载大量数据的最佳方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!