切换到LINQ [英] Switching to LINQ

查看:79
本文介绍了切换到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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆