• 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 ) );

  • 相关阅读:
    gitlab 国内镜像安装
    docker 安装和启动redis
    jenkins 国内镜像更新地址
    docker 安装 jenkins
    docker 使用阿里云镜像加速
    '
    windows/linux 命令可以用符号连接执行
    思科访问控制列表优先级
    交换机泛洪
    虚拟机floppy0
  • 原文地址:https://www.cnblogs.com/williamzhao/p/2410618.html
Copyright © 2020-2023  润新知