Data access by using LINQ and. NET, and data access by using LINQ. NET

Source: Internet
Author: User

Data access by using LINQ and. NET, and data access by using LINQ. NET
. NET data access

In. NET, there are roughly three layers for data access: data access layer, memory dataset, and business logic layer. Data layer, including XML configuration files and some common databases (using SQL statements); Memory datasets, mainly DataSet datasets, including Datatable in DataSet, dataRow and DataColumn are available in able. Data in a specific dataset is generally accessed through DataRow. the business logic layer is a generic set of commonly used objects.

Basics

It corresponds to three layers of Data Access: data access layer, using LINQ to XML, LINQ to SQL, and LINQ to Entities; In-memory DataSet, using LINQ to DataSet; business logic layer, use LINQ to Object.

In retrospect, we often need to use filtering, grouping, and conversion to extract information from the object set to get the correct output. We may use for and foreach to traverse the information cyclically, check each object according to some conditions, and operate or save the object. These codes are imperative codes.

Currently, using LINQ to operate on object sets is declarative code. This type of code is highly efficient in development and readable. At the business logic layer, using LINQ to Object can improve execution efficiency. The LINQ language is similar to SQL. It has from, where, select, join, group by, and order by statements.

The general process used by LINQ. Generally, the operation is a generic set of objects. After using the frequently-used LINQ statements, the IEnumerable generic set is extracted for the foreach iterator to traverse.

Not complete .......

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.