• LINQ 小解


    LINQ to Objects

    LINQ to ADO.NET -|-LINQ to SQL
                     |-LINQ to DataSet
                     |-LINQ to Entiries
    LINQ to XML


    (SOAP)Simple Object Access Protocol 

    LINQ to Object
    LINQ query that gets temporary files greater than 10,000 bytes, ordered by size

                 string tempPath = Path.GetTempPath();
                 DirectoryInfo dirInfo = new DirectoryInfo( tempPath );
                 var query =
                      from     f in dirInfo.GetFiles()
                      where   f.Length > 10000
                      orderby f.Length descending
                      select   f;

    LINQ to ADO.NET
     LINQ to ADO.NET includes different LINQ implementations that share the need to manipulate
              relational data. It includes other technologies that are specific to each particular persistence layer:

                ■    LINQ to SQL     Handles the mapping between custom types in C# and the physical table
                    schema.

                ■    LINQ to Entities   Is in many ways similar to LINQ to SQL. However, instead of using the
                    physical database as a persistence layer, it uses a conceptual Entity Data Model (EDM).
                    The result is an abstraction layer that is independent from the physical data layer.

                ■    LINQ to DataSet     Makes it possible to query a DataSet using LINQ.

     LINQ to SQL and LINQ to Entities have similarities because they both access information
              stored in a relational database and operate on object entities that represent external data in
              memory. The main difference is that they operate at a different level of abstraction. While
              LINQ to SQL is tied to the physical database structure, LINQ to Entities operates over a con-
              ceptual model (business entities) that might be far from the physical structure (database
              tables).

              The reason for these different options for accessing relational data through LINQ is that
              different models for database access are in use today. Some organizations implement all access
              through stored procedures, including any kind of database query, without using dynamic
              queries. Many others use stored procedures to insert, update, or delete data and dynamically
              built SELECT statements to query data. Some see the database as a simple object persistence
              layer, while others put some business logic into the database using triggers, stored proce-
              dures, or both. LINQ tries to offer help and improvements in database access without forcing
              everyone to adopt a single comprehensive model.
    LINQ to XML

              LINQ to XML offers a slightly different syntax that operates on XML data, allowing query and
              data manipulation. A particular type of support for LINQ to XML is offered by Visual Basic
              9.0, which includes XML literals in the language. This enhanced support simplifies the code
              necessary to manipulate XML data. In fact, you can write such a query in Visual Basic 9.0:

              Dim book = _
                  <Book Title="Introducing LINQ">
                       <%= From person In team _
                           Where person.Role = "Author" _
                           Select <Author><%= person.Name %></Author> %>
                  </Book>

              This query corresponds to the following C# 3.0 syntax:

              dim book =
                  new XElement( "Book",
                       new XAttribute( "Title", "Introducing LINQ" ),
                       from   person in team
                       where  person.Role == "Author"
                       select new XElement( "Author", person.Name ) );

  • 相关阅读:
    发起qq临时会话
    easyUI-textbox回车获取不到正确的textbox值问题
    Linq in条件查询
    常用js-API
    MVC4不支持EF6解决方案 && Nuget控制台操作说明
    JS报表打印分页CSS
    关于phpinfo页面展开的渗透
    基于phpmyadmin的攻击
    upload_labs靶场
    文件上传漏洞
  • 原文地址:https://www.cnblogs.com/williamzhao/p/2410618.html
Copyright © 2020-2023  润新知