问题描述
我已经使用 LINQ 工作了很长时间.然而,所提到的 LINQ 风格之间的真正区别是什么仍然是一个谜.
I've been working for quite a while now with LINQ. However, it remains a bit of a mystery what the real differences are between the mentioned flavours of LINQ.
成功的答案将包含它们之间的简短区别.每种风味的主要目标是什么,有什么好处,是否对性能有影响...
附:我知道那里有很多信息来源,但我正在寻找一种备忘单",它可以指导新手去哪里实现特定目标.
P.S. I know that there are a lot of information sources out there, but I'm looking for a kind of a "cheat sheet" which instructs a newbie where to head for a specific goal.
推荐答案
它们都是 LINQ - 语言集成查询 - 所以它们都有很多共同点.所有这些方言"基本上都允许您对来自各种来源的数据进行查询式选择.
all of them are LINQ - Language Integrated Query - so they all share a lot of commonality. All these "dialects" basically allow you to do a query-style select of data, from various sources.
Linq-to-SQL 是微软首次尝试 ORM - 对象关系映射器.它仅支持 SQL Server.这是一种将 SQL Server 数据库表映射到 .NET 对象的映射技术.
Linq-to-SQL is Microsoft's first attempt at an ORM - Object-Relational Mapper. It supports SQL Server only. It's a mapping technology to map SQL Server database tables to .NET objects.
Linq-to-Entities 是相同的想法,但在后台使用实体框架,作为 ORM - 再次来自 Microsoft,但支持多个数据库后端
Linq-to-Entities is the same idea, but using Entity Framework in the background, as the ORM - again from Microsoft, but supporting multiple database backends
Linq-to-DataSets 是 LINQ,但使用的是针对旧式"ADO.NET 2.0 数据集的 - 在 Microsoft 推出 ORM 之前的时代,你可以做的只是ADO.NET 返回 DataSets、DataTables 等,Linq-to-DataSets 查询这些数据存储以获取数据.因此,在这种情况下,您将从数据库后端返回一个 DataTable 或 DataSets(System.Data 命名空间),然后使用 LINQ 语法查询它们
Linq-to-DataSets is LINQ, but using is against the "old-style" ADO.NET 2.0 DataSets - in the times before ORM's from Microsoft, all you could do with ADO.NET was returning DataSets, DataTables etc., and Linq-to-DataSets queries those data stores for data. So in this case, you'd return a DataTable or DataSets (System.Data namespace) from a database backend, and then query those using the LINQ syntax
这篇关于“LINQ to Entities"、“LINQ to SQL"有什么区别?和“LINQ to Dataset"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!