.Net 数据处理建议

发布于 2024-07-08 03:49:49 字数 445 浏览 8 评论 0原文

我刚刚开始写一个应用程序。 它需要做的部分工作是对营养信息数据库进行查询。 我拥有的是 USDA 的 SR21 数据集,其形式为平分隔 ASCII 文件。

我需要的是建议。 我正在寻找将此数据导入应用程序并在运行时轻松快速地查询的最佳方法。 我将用它来处理所有标准的事情。 动态填充控件、数据网格、计算等。我还需要进行用户特定的持久数据存储。 这不会是一个商业应用程序,所以希望这能带来更多可能性。 我对 .Net Framework 3.5 很满意,因此在访问数据时可以使用 Linq(只是不知道它是否是最佳解决方案)。 那么,在这种情况下对于持久存储有哪些建议呢? 我应该注意哪些类型的问题? 当然,示例链接总是值得赞赏的。

I am just beginning to write an application. Part of what it needs to do is to run queries on a database of nutritional information. What I have is the USDA's SR21 Datasets in the form of flat delimited ASCII files.

What I need is advice. I am looking for the best way to import this data into the app and have it easily and quickly queryable at run time. I'll be using it for all the standard things. Populating controls dynamically, Datagrids, calculations, etc. I will also need to do user specific persistent data storage as well. This will not be a commercial app, so hopefully that opens up the possibilities. I am fine with .Net Framework 3.5 so Linq is a possibility when accessing the data (just don't know if it would be the best solution or not). So, what are some suggestions for persistent storage in this scenario? What sort of gotchas should I be watching for? Links to examples are always appreciated of course.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

倾城月光淡如水﹏ 2024-07-15 03:49:49

它看起来很小,因此我会制定一个适当的对象模型,将整个对象模型加载到内存中,然后使用 LINQ to Objects。

我不太确定你在“持久存储”方面询问什么 - 你不只是读取数据吗? 你不是已经在文本文件中了吗? 我不确定你为什么想介绍其他东西。

It looks pretty small, so I'd work out an appropriate object model, load the whole lot into memory, and then use LINQ to Objects.

I'm not quite sure what you're asking about in terms of "persistent storage" - aren't you just reading the data? Don't you already have that in the text files? I'm not sure why you'd want to introduce anything else.

野稚 2024-07-15 03:49:49

我会将平面文件导入 SQL Server 并通过标准 ADO.NET 功能进行访问。 就数据查询和操作而言,数据库访问不仅总是比文件 I/O 更好(更健壮、更强大),而且您还可以利用 SQL Server 的缓存功能,特别是因为这些营养数据不会发生太大变化经常。

如果您需要定期下载更新的平面文件,请考虑开发一项服务来轮询这些文件并自动导入到 SQL Server 中。

编辑:我指的是 SQL Server,但可以随意使用任何 DBMS。

I would import the flat files into SQL Server and access via standard ADO.NET functionality. Not only is DB access always better (more robust and powerful) than file I/O as far as data querying and manipulation goes, but you can also take advantage of SQL Server's caching capabilities, especially since this nutritional data won't be changing too often.

If you need to download updated flat files periodically, then look into developing a service that polls for these files and imports into SQL Server automatically.

EDIT: I refer to SQL Server, but feel free to use any DBMS.

就是爱搞怪 2024-07-15 03:49:49

我的诱惑是将数据导入 SQL Server(如果您不打算部署应用程序,则为 Express),因为它对我来说是熟悉的来源。 或者,您可以使用文本文件处理程序创建 ODBC 数据源,以获得类似数据库的连接。

My temptation would be to import the data into SQL Server (Express if you aren't looking to deploy the app) as it's a familiar source for me. Alternatively you can probably create an ODBC data source using the text file handler to get you a database-like connection.

森末i 2024-07-15 03:49:49

我同意您将从数据库中受益,特别是对于快速查询,如果您保存用户对数据的更改,则更是如此。 为了将平面文件数据加载到 SQL Server(包括 Express)中,您可以使用 SSIS。

I agree that you would benefit from a database, especially for rapid querying, and even more so if you are saving user changes to the data. In order to load the flat file data into a SQL Server (including Express), you can use SSIS.

愁杀 2024-07-15 03:49:49

使用Linq或文本数据列出方法

1.创建列表。

2.逐行(或所有行)读取文本文件。

3.处理该行 - 获取所需数据并附加到列表中。

4.处理该列表以供进一步使用。

持久性存储将是文件,而列表是易失性的。

Use Linq or text data to list method

1.create a list.

2.Read the text file line by line (or all lines).

3.process the line - get required data and attach to the list.

4.process the list for any further use.

the persistence storage will be files and List is volatile.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文