使用 Access DB 作为数据源进行 ORM 的最佳方法

发布于 2024-07-29 04:11:44 字数 353 浏览 1 评论 0原文

我在这个问题上反复思考,似乎无法找出最好的方法来做到这一点。

情况如下:

  • 访问数据库(第 3 方产品),其中包含我需要的数据,来自大量表(18 个表)
  • 进行查询
  • 理想情况下,需要尝试以某种方式将记录获取到强类型对象中,以便我可以使用 LINQ LINQ SQL 类不支持 ODBC 提供程序(这会让我自由地回家)
  • 我不需要插入/更新/删除。 仅选择/读取。

我曾考虑过将表导出到 XML(没那么多)的想法,但我仍然面临着构建架构和生成类的问题。 既然它是 ODBC 源,就应该有一种 ORM 方法,对吧?

你会如何解决这个问题?

I've gone back and forth on this problem and can't seem to figure out the best way to do this.

Here's the situation:

  • Access database (3rd party product) with data I need in it, from a good number of tables (18 tables)
  • Ideally, need to try to get records into strongly-typed objects somehow so I can query around with LINQ
  • LINQ to SQL classes don't support ODBC provider (this would have gotten me home free)
  • I do NOT need to insert/update/delete. Only select/read.

I've toyed around with the idea of just exporting the tables to XML (it's not that much) but then I'm still faced with the problem of building the schema and generating the classes. Since it's an ODBC source there should be a way to ORM this, right?

How would you solve this?

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

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

发布评论

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

评论(3

莳間冲淡了誓言ζ 2024-08-05 04:11:44

您可以使用 nHibernate 来完成此操作,因为它支持 MS Access 作为后端。 以下是将 nHibernate 与 MS Access 结合使用的详细信息。 它使用 NHibernate.JetDriver.dll 来访问 Jet 数据引擎 (MS Access)。

只是要意识到,MS Access 不会为您提供与大多数其他具有 ORM 的数据库后端相同的性能/支持/等。

You can do this using nHibernate, since it supports MS Access as a backend. Here are the details of using nHibernate with MS Access. It uses NHibernate.JetDriver.dll to access the Jet data engine (MS Access).

Just realize that MS Access isn't going to give you the same performance/support/etc as most other DB backends with an ORM.

烟凡古楼 2024-08-05 04:11:44

使用NHibernate访问的dll似乎在sourceForge上(只是谷歌搜索,没有检查)
http://sourceforge.net/project/shownotes.php?release_id=460590
如果您只是查询访问权限,那么可能值得在关系数据库中定义视图
这样,您稍后将获得使用缓存/快照形式的解决方案(例如,将视图转换为每小时/5分钟刷新一次的表。等等,具体取决于您的期望)
如果性能下降太多。

The dll for using NHibernate to Acccess seems to be on sourceForge (just googling, not checking)
http://sourceforge.net/project/shownotes.php?release_id=460590
If you are just querying access, it might be worth defining views in a relationnal database
This way you will have a solution for using a form of cache/snapshot later on(for example by converting your views into table that you refresh each hour/ 5min. etc depending on your expectations)
if the performance degrade too much.

深海夜未眠 2024-08-05 04:11:44

我刚刚回答了我自己的问题...

我可以在服务器资源管理器中建立 ODBC 连接,然后将表直接拖到预定义的数据集中并使用 TableAdapter.Fill()

I just answered my own question...

I can just establish the ODBC connection in Server Explorer, and drag the tables straight into a predefined DataSet and use a TableAdapter.Fill()

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