是否有支持计算列的内存数据库?

发布于 2024-08-04 10:30:58 字数 362 浏览 4 评论 0原文

我们有一个 SQL 2005/2008 数据库,其中有一个带有计算列的表。我们在 NHibernate 中使用计算列作为鉴别器,因此将其存储在数据库中被证明是非常有用的。

为了获得更快的集成测试的好处,我希望能够针对内存数据库(例如 SQLite 或 SQL CE)运行集成测试。但我认为其中任何一个都不支持计算列。

我的问题还有其他解决方案吗?我可以完全访问数据库,并且如果有更好的解决方案可用,可以对其进行修改。我看过 这篇文章 建议使用视图而不是计算列,这是最好的选择吗?

We have a SQL 2005/2008 database that has a table with a computed column. We're using the computed column as a discriminator in NHibernate so having it in the database is proving to be very useful.

In order to gain the benefits of faster integration tests, I'd like to be able to run our integration tests against an in-memory database such as SQLite or SQL CE. But I don't think either of those support the computed column.

Are there any other solutions to my problem? I have complete access to the database and can modify it if there's a better solution available. I've seen this post that suggests using a view instead of a computed column, is this the best alternative?

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

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

发布评论

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

评论(1

新人笑 2024-08-11 10:30:58

我所做的就是在从 SqlCe 加载表时将计算列添加到 DataTable 中。我将计算的 DataColumn 的定义存储在数据库中存储的“配置”表中。我能够进行依赖于表“链”的复杂计算,其中每个表执行更复杂函数的更简单函数。 (链中的最后一个表包含结果。)我使用 SqlCe,因为一个 5 个表包含 1500 万行。 ADO.NET 内存中数据集的数据过多。 (我需要在发布到服务器之前使用基于本地客户端的计算。)

What I did was added the computed column to the DataTable when loading the table from SqlCe. I stored the definition of the computed DataColumn in a "configuration" table stored in the database. I was able to do complex calculations that depended on a "chain" of tables, where each table performed a simplier function of a more complex function. (The last table in the chain contained the results.) I used SqlCe because one table of five contained 15 million rows. Too much data for the in-memory data sets of ADO.NET. (I had a requirement of using local client based calculations before posting to server.)

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