切换到LINQ

编程入门 行业动态 更新时间:2024-10-24 22:19:27
本文介绍了切换到LINQ的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在考虑花时间学习和使用LINQ to SQL,但是经过多年的最佳实践建议不要嵌入SQL,我很难改变范式.

I'm considering spending time learning and using LINQ to SQL but after years of best practices advising NOT to embed SQL I'm having a hard time changing paradigms.

为什么现在似乎接受将查询嵌入到已编译的代码中?在某些方面对我来说似乎快退了一步.

Why does it seem accepted now to embed queries in compiled code? It seems almost a step backwards to me in some ways.

切换到LINQ后,是否有人在修复查询/编译/部署周期方面遇到问题?

Has anyone had issues with fix query / compile / deploy cycle after switching to LINQ?

我认为我仍然可能要等待完成的实体框架.

I think I still might wait for the finished Entity Framework.

您怎么看?

推荐答案

Linq to Sql的优点是它不会将查询真正嵌入到已编译的代码中-并非如此. Linq语句意味着您的.Net代码实际上具有构建嵌入式Sql语句所需的逻辑,而不是原始Sql.

The advantage of Linq to Sql is that it doesn't really embed queries in compiled code - not really. The Linq statement means that your .Net code actually has the logic required to build the Sql statement embedded, not the raw Sql.

让.Net代码直接转换为Sql来执行,而不是一堆带有相关文档的proc,这确实很有意义. Linq方法更易于维护和改进.

It really makes a lot of sense to have .Net code that converts directly to the Sql to execute, rather than a long list of sprocs with associated documentation. The Linq way is much easier to maintain and improve.

我不认为我会将现有项目切换到Linq-确实是整个数据层的替代品,它可以更改对该层的所有访问的方式.除非您从非常相似的模型中切换,否则对于任何潜在的收益来说,成本都将太高.

I don't think I'd switch an existing project to Linq - really it's a replacement for the entire data-layer and it can change the way all access to that layer is done. Unless you're switching from a very similar model the cost is going to be far too high for any potential gains.

Linq对Sql的真正作用在于快速创建新应用程序-它使您可以非常快速地创建数据层代码.

Linq to Sql's real power is in quickly creating new applications - it allows you to very rapidly create the data-layer code.

更多推荐

切换到LINQ

本文发布于:2023-11-11 23:41:40,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1579869.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:切换到   LINQ

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!