zoukankan      html  css  js  c++  java
  • linq to object 与 linq to entity

    一、linq to object

    The term "LINQ to Objects" refers to the use of LINQ queries with any IEnumerable or IEnumerable<T> collection directly,

    without the use of an intermediate LINQ provider or API such as LINQ to SQL [LINQ to SQL] or LINQ to XML.

    You can use LINQ to query any enumerable collections such as List<T>Array, or Dictionary<TKey, TValue>.

    The collection may be user-defined or may be returned by a .NET Framework API.

    通过以上定义,linq to object 即对List<T>Array, or Dictionary<TKey, TValue>对象的查询。

    二、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:

    1. Construct an ObjectQuery<T> instance from ObjectContext.

    2. Compose a LINQ to Entities query in C# or Visual Basic by using the ObjectQuery<T> instance.

    3. Convert LINQ standard query operators and expressions to command trees.

    4. Execute the query, in command tree representation, against the data source. Any exceptions thrown on the data source during execution are passed directly up to the client.

    5. Return query results back to the client.

    通过以上定义,对通过DBcontext对象创建出来的实例,才归属entity,对该对象的查询才是linq to entiry.

  • 相关阅读:
    Json基本使用方法
    Java编程思想(20170818)
    FireFox加载Lodop控件
    泛型
    设计模式原则
    设计模式
    设计模式3.1:简单工厂模式
    设计模式2,模板方法
    spring -- AutoCloseable 作用
    spring 源码方法概要
  • 原文地址:https://www.cnblogs.com/windy3417/p/14330194.html
Copyright © 2011-2022 走看看