评估 LINQ 查询时确定进度

发布于 2024-09-17 21:47:30 字数 114 浏览 2 评论 0原文

我的 C# 程序长期执行针对 MS SQL Server 数据库运行的 LINQ 查询。我想在执行查询时向用户显示进度。有没有办法了解LINQ执行进度?当然,我可以显示不确定的进度,但如果可能的话,我更喜欢确定的。

My C# program has long executed LINQ query running against MS SQL Server database. I'd like to show user a progress while executing the query. Is there any way to understand LINQ execution progress? Of course I can show undeterminate progress, but if possible, I'd prefer determinate.

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

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

发布评论

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

评论(2

余生一个溪 2024-09-24 21:47:30

它实际上与 LINQ 查询无关,而是与底层提供程序有关。由于 SQL Server 对于任何给定的查询没有任何进度概念,因此 LINQ 也没有。无论如何,即使底层数据源有一些进度概念,LINQ 框架也没有挂钩将其转发给调用者。所以,不幸的是,答案是否定的。

It's not really about the LINQ query, but rather that of the underlying provider. As SQL Server doesn't have any notion of progress for any given query, LINQ cannot either. Regardless, even if the underlying datasource had some notion of progress, the LINQ framework does not have hooks to relay this to the caller. So, the answer is no, unfortunately.

和我恋爱吧 2024-09-24 21:47:30

使用 LINQtoSQL 无法做到这一点。 LINQtoSQL 只是将 LINQ 查询转换为 SQL 查询并将其发送到数据库。然后您只需等待数据库返回结果即可。没有办法为此取得任何进展。

There is no way to do that using LINQtoSQL. LINQtoSQL simply translates your LINQ query to a SQL query and sends it to the database. Then you simply wait until the database returns with results. There is no way to get any progress for that.

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