我正在考虑花时间学习和使用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
发布评论