使用 sqlclr 编写 .net 代码的 t-sql 版本

发布于 2024-09-13 12:31:07 字数 102 浏览 3 评论 0原文

我有很多用 .net 代码(c#)编写的方法,用于 linq 查询。但我在将方法转换为 t-sql 时遇到问题。我想将其转换为 t-sql 函数并直接将其与 t-sql 查询一起使用。如何?

i have a lot of methods wrote with.net codes (c#) to using with linq queries. but i have problem to translating methods to t-sql. and i want to convert that to t-sql functions and using that with t-sql queries directly. how?

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

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

发布评论

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

评论(2

无名指的心愿 2024-09-20 12:31:07

将 Linq 转换为 Sql...我建议下载 LinqPad。 Linqpad.net。它应该为你做一份合理的工作。

Translating Linq to Sql... I would recommend downloading LinqPad then. Linqpad.net. It should do a reasonable job for you.

要走干脆点 2024-09-20 12:31:07

像这样移植数据访问层很容易出错。我建议您首先为要转换的所有方法创建单元测试。然后移植到 SQL。您不一定希望运行与 LINQ To SQL 输出相同的 SQL,因为您可能可以通过手动编码查询来提高性能,但要了解 LINQ to SQL 正在做什么,您可以跟踪SQL Server 上的 SQL。

Porting data access layers like this is error-prone. I suggest you first create unit tests for all of the methods you want to convert. Then port over to SQL. You don't necessarily want to run the same SQL as is output by LINQ To SQL, as you can likely improve on the performance by hand-coding the queries, but to get an idea of what LINQ to SQL is doing, you can trace the SQL on your SQL Server.

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