[英]What's Different Between LINQ and Entity Framework?
I know the benefit of the LINQ and I know use of it in .Net Application. 我知道LINQ的好处,我知道在.Net应用程序中使用它。 I fill same thing there are providing as a Entity Framework. 我填写了作为实体框架提供的相同内容。
So What's Major Difference between LINQ and Entity Framework? 那么LINQ和实体框架之间的主要区别是什么?
LINQ could be applied to any data source: in-memory objects, XML, SQL, ... LINQ可以应用于任何数据源:内存中对象,XML,SQL,......
Entity Framework could use LINQ to perform queries against a relational database. 实体框架可以使用LINQ对关系数据库执行查询。
LINQ to SQL is the predecessor of Entity Framework and is obsolete now. LINQ to SQL是Entity Framework的前身,现在已经过时了。
Comparing EF and LINQ is incorrect. 比较EF和LINQ是不正确的。 Both are different things and they often work together to give better developer experience (and productivity benefit). 两者都是不同的东西,它们经常一起工作,以提供更好的开发人员体验(和生产力效益)。
LINQ is querying syntax/model that can be applied to any data source. LINQ查询可应用于任何数据源的语法/模型。 EF provides one such data source. EF提供了一个这样的数据源。
They are somewhat similar, and can be used in a very similar way, code-wise, but they have some important differences. 它们有点相似,并且可以以非常类似的方式使用,代码方面,但它们有一些重要的区别。 Note that "LINQ" is not the same thing as "LINQ to SQL"; 请注意,“LINQ”与“LINQ to SQL”不同; the EF also uses LINQ. EF也使用LINQ。 Some notable differences are: 一些值得注意的差异是:
I totally agree with VinayC. 我完全同意VinayC。 You cannot really compare. 你不能真正比较。
With Entity Framework, you will be able to have a whole representation of your database in your program. 使用Entity Framework,您将能够在程序中拥有数据库的完整表示。 It will help you create classes corresponding to the database elements, connected together like they are in the database. 它将帮助您创建与数据库元素相对应的类,它们像在数据库中一样连接在一起。 You can after interact with elements of theses classes directly, and like this impact the database. 您可以直接与这些类的元素进行交互,并且这样会影响数据库。 You will have some representation of these classes diagram in visual studio. 您将在visual studio中对这些类图表进行一些表示。 It's basically often simpler than working directly with the database elements, even if setting it up requires some effort. 它基本上比直接使用数据库元素更简单,即使设置它需要一些努力。
The use of Linq is to perform queries on the data sources. Linq的使用是对数据源执行查询。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.