将“Linq 到 EF”转换为到“Linq to Sql”在.NET中

发布于 2024-12-26 06:38:41 字数 110 浏览 2 评论 0原文

我使用 Linq to Entity Framework 创建了一个项目。但我读到 Linq to Sql 比 EF 更快。那么我可以将我的项目从 Linq to EF 转换为 Linq to Sql 吗?

I have created a project using Linq to Entity Framework. But I have read that Linq to Sql is faster than EF. So Can I convert my project from Linq to EF to Linq to Sql?

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

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

发布评论

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

评论(2

谷夏 2025-01-02 06:38:41

我不认为“Linq to Sql 比 EF 更快”是一个普遍正确的说法。如果数据库通信带来性能问题,我会首先开始调查 SQL 端,看看数据存储/查询的方式是否可以改进(例如,必要时添加索引)。

否则,翻译项目的努力可能不会得到回报。

I don't think "Linq to Sql is faster than EF" is a generally true statement. If the database communication poses performance problems, I'd first start investigating the SQL side to see if the way data is stored/queried can be improved (for example, add indexes if necessary).

Otherwise the effort of translating the project might not pay off.

著墨染雨君画夕 2025-01-02 06:38:41

出于长期可维护性的原因,您可能不想从 EF 转向 Linq2SQL,因为 Microsoft 实际上已经放弃了 Linq2SQL 上的新开发工作,从 .NET 4 开始将该项目合并到 EF 中。仅仅为了可能看到一些未经证实的性能提升声明而尝试转换为不太现代和不太积极开发的东西是不值得的。

For long term maintainability reasons, you probably don't want to go from EF to Linq2SQL, because Microsoft have effectively abandoned new development work on Linq2SQL, having folded the project into EF from .NET 4 onwards. It's not worth the effort trying to convert onto something that's less modern and less actively developed just to potentially see some unsubstantiated claims of performance gains.

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