LinqToSQL 与 Linq 相同吗?
我刚刚读到有关 Linq to SQL 已停止使用的消息。 有一段时间我完全推迟了学习 Linq。 即使在 asp.net 上,当我上次检查时,他们的数据访问教程也在使用表适配器和 bll 类。 然后还有linq教程。 既然我已经阅读了这篇文章并且实体框架是新的发展方向,这是否意味着我一年半以来一直在阅读的所有 Linq“东西”,它有多棒等等,就是这一切刚刚走了? 似乎没有人能够确定正确的做事方式,或者至少确定 MS 产品的某种标准方式。 我知道你不能说一种方法适合所有情况。 但是,在这种特殊情况下,我不明白为什么不能对数据访问进行一些解决。
或者,Linq To SQL 只是 Linq 的 ORM 部分吗? 如果我想使用 ORM,我现在到底要学什么? 我在 StackOverflow 上读过几篇文章,但没有一篇能真正帮助我知道该怎么做。
看起来 nHibernate 可能比 Microsoft 的任何选择都要好。 是的,我知道还有其他人(亚音速,以及在各种 SO 问题中提到的其他人。)
谢谢。
I was just reading about Linq to SQL being discontinued. For a while I put off learning Linq at all. Even on asp.net, when I last checked, their data access tutorials were using table adapters and bll classes. Then there are linq tutorials. Now that I have read this and that the Entity Framework is the new way to go, does that mean all the Linq "stuff" I have been reading about for a year and a half, how great it is, etc., is all this just gone? No one ever seems to settle on the right way to do things or at least some standard way with MS products. And I understand that you can't say one way is right for everything. But, in this particular case I do not understand why there cannot be some settling on data access.
Or, is Linq To SQL just the ORM portion of Linq? What exactly would I learn now if I wanted to use an ORM? I have read several things on StackOverflow, but none that really help me know what to do.
It seems that nHibernate may be better than any of the Microsoft choices. Yes, I know there are others (subsonic, and others were mentioned in various SO questions.)
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
不会。LINQ
to SQL 构建于 LINQ 之上,LINQ 是 .NET 3.5 Framework 中添加的基本语言功能之一。
从技术上讲,其他 ORM 可以实现自己的 LINQ 系统,例如,NHibernate 已经支持 LINQ to NHibernate。 这是框架中提供的框架之上的,例如 LINQ to XML、LINQ to Objects 等。
No.
LINQ to SQL is built on top of LINQ, which is one of the fundamental added language features in .NET 3.5 Framework.
Technically other ORMs can implement their own LINQ systems, e.g., NHibernate already has LINQ to NHibernate going. This is on top of the ones provided in the framework, such as LINQ to XML, LINQ to Objects etc.
实体框架当然并不意味着 LINQ 将会消失 - 实体框架本身就是一个 LINQ 提供程序!
LINQ 是一个完整的技术集合,而且不仅如此,它还是一种您也可以为自己的数据提供程序实现的模式。
LINQ to SQL 只是该模式的一个示例。 就其价值而言,我认为 LINQ to SQL 正在被不再强调,而不是真正消失,但我们会看到......
就我个人而言,我发现 LINQ to Objects 首先是最有用的 LINQ 提供程序:)
The Entity Framework certainly doesn't mean that LINQ is going away - the Entity Framework is a LINQ provider itself!
LINQ is a whole collection of technologies, and more than that - it's a pattern which you can implement for your own data provider as well.
LINQ to SQL is just one example of that pattern. For what it's worth, I think LINQ to SQL is being de-emphasized rather than actually going away, but we'll see...
Personally I find LINQ to Objects the most useful LINQ provider in the first place :)
Linq to sql 只是众多 linq 提供程序之一(还有 linq to db4o、linq to starcounter、linq to object、linq to ado 等等)。 实体框架有自己的 linq 提供程序,称为 linq to enteties。 您阅读有关 linq 的一年并没有白费。
Linq to sql is just one of many linq providers out there (there is linq to db4o, linq to starcounter, linq to objects, linq to ado and many, many more). The entity framework has its own linq provider, called linq to enteties. Your year of reading about linq is not lost.
Linq 不仅仅是 Linq-to-SQL。 例如,Linq-to-Objects 和 Linq-to-XML 等都是该技术的一部分。
我怀疑他们会消失! 手指交叉。 ;-)
Linq is much more than Linq-to-SQL. Things like Linq-to-Objects and Linq-to-XML are part of the technology, for example.
I doubt they are going away! Fingers crossed. ;-)
LINQ 并没有消失。 LINQ to SQL 也没有,但它不是 Microsoft 的数据访问战略平台,而是实体框架。 EF 使用 LINQ to Entities,因此如果您花时间学习 LINQ,它仍然有效且有用。
不过,LINQ 并不是特定于产品的技术。 很容易利用(几乎)所有类型的集合的功能和灵活性。 例如。
是(概念上)有效的,即使这里的代码示例有缺陷。
LINQ hasn't gone away. LINQ to SQL hasn't either, but it is not Microsoft's strategic platform for data access, that would be Entity Framework. EF uses LINQ to Entities so if you've spent time learning about LINQ, it'll still be valid and useful.
LINQ isn't a product-specific technology, though. It is easy to leverage the power and flexibility in collections of (almost) all kinds. eg.
is (conceptualy) valid, even if the code example here is flawed.
LINQ 是一个用于处理数据序列的库。 这真是太棒了。
这些数据序列可以是实现 IEnumerable 的任何序列,也可以是适配器提供的任何序列。
Linq to SQL 是一个适配器,允许 SQL 数据库提供与 LINQ 兼容的数据序列。
还有一个 Linq to XML,它是一个适配器,可让您将 XML 文档视为数据序列,从而允许 LINQ 处理它。
LINQ 只是一种查询语言,而且它的功能非常出色。 它与数据库或 SQL 无关。 能够轻松处理内存中的集合绝对值得学习。
LINQ is a library for processing sequences of data. And it is pretty awesome.
These sequences of data may be anything that implements IEnumerable, or it may be whatever sequences are provided by adapters.
Linq to SQL is an adapter which allows a SQL database to provide sequences of data that are compatible with LINQ.
There is also a Linq to XML which is an adapter that lets you treat an XML document as a sequence of data, allowing LINQ to process it.
LINQ is just the query language, and it is extremely good at what it does. It has nothing to do with databases or SQL. It is definitely worth learning just to be able to process in-memory collections easily.