zoukankan      html  css  js  c++  java
  • 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 ) );

  • 相关阅读:
    docker中安装python3.8
    deeplearning系列(四)主成分分析与白化
    Aspect# 应用实例
    招兼职程序员(仅限北京)
    今天开始学Pattern Recognition and Machine Learning (PRML)书,章节1.2,Probability Theory 概率论(上)
    今天开始学Pattern Recognition and Machine Learning (PRML),章节1.2,Probability Theory (下)
    今天开始学Pattern Recognition and Machine Learning (PRML),章节1.1,介绍与多项式曲线拟合(Polynomial Curve Fitting)
    机器学习降维算法四:Laplacian Eigenmaps 拉普拉斯特征映射
    今天开始学Pattern Recognition and Machine Learning (PRML),章节1.6,Information Theory信息论简介
    Linux系统安装shapely报错:OSError: Could not find library geos_c or load any of its variants ['libgeos_c.so.1', 'libgeos_c.so']解决办法
  • 原文地址:https://www.cnblogs.com/williamzhao/p/2410618.html
Copyright © 2011-2022 走看看