linq to entities vs linq to objects - are they the same?

后端 未结 5 2032
长发绾君心
长发绾君心 2020-12-04 17:55

I usually use the term entity to represent a business data object and in my mind, the linq to entities and linq to objects were the sa

5条回答
  •  南笙
    南笙 (楼主)
    2020-12-04 19:00

    Linq to Objects The term "LINQ to Objects" refers to the use of LINQ queries with any IEnumerable or IEnumerable collection directly, without the use of an intermediate LINQ provider or API such as LINQ to SQL or LINQ to XML. You can use LINQ to query any enumerable collections such as List, Array, or Dictionary. The collection may be user-defined or may be returned by a .NET Framework API.

    In a basic sense, LINQ to Objects represents a new approach to collections. In the old way, you had to write complex foreach loops that specified how to retrieve data from a collection. In the LINQ approach, you write declarative code that describes what you want to retrieve.

    ref :http://msdn.microsoft.com/en-us/library/bb397919.aspx

    Linq to Entity LINQ to Entities provides Language-Integrated Query (LINQ) support that enables developers to write queries against the Entity Framework conceptual model using Visual Basic or Visual C#. Queries against the Entity Framework are represented by command tree queries, which execute against the object context. LINQ to Entities converts Language-Integrated Queries (LINQ) queries to command tree queries, executes the queries against the Entity Framework, and returns objects that can be used by both the Entity Framework and LINQ. The following is the process for creating and executing a LINQ to Entities query: Ref : http://msdn.microsoft.com/en-us/library/bb386964.aspx

提交回复
热议问题