LINQ to SQL Advanced Series (i)-from mapping

Source: Internet
Author: User
Tags net domain

This series, more or less, relies directly or indirectly on the introductory series of knowledge. But, still pursue independence. Due to the limited level of the author, the error is unavoidable in the article, please point out the reader and understanding. This series will coexist with the primer.

Case

Some gentleman was invited to a supermarket design database, used to store data. According to the actual objects in the supermarket, the gentleman designed the customer, Employee,order, product and other tables to keep the corresponding customers, employees, orders, goods and so on. Too good, the gentleman has the idea of OO.

What do you do if you are asked to use classes and objects to describe the relational data? Before LINQ is launched, ADO. NET is used to do the data access layer. Then the programmer needs to write the classes that appear in the logic layer of the transaction themselves. For example, Customer, Employee, order, product, etc. The programmer then assembles the required SQL statements and, through Ado.net, returns the records that initialize the objects of the customer class. Here, you've got to associate the Customer table with the customer class yourself. From the design of LINQ to SQL, it is mainly to solve the problem of data!=objects. Now, with the mapping between table and class, there can be a one by one correspondence between the data and the object.

Before LINQ to SQL, there was a hibernate in the Java realm, with NHibernate technology in the net domain to implement object/relational persistence and query services. Whether it is hibernate or nhibernate, its configuration is complex and the time of getting started is long, it can't meet the need of rapid development. and the introduction of LINQ to SQL, just to make up for their shortcomings, and completely reduce the threshold for program development.

Linq

LINQ is the abbreviation for language Integrated query. LINQ to SQL is part of LINQ and has a relationship with ado.net orcas.

Now LINQ is divided into three parts. LINQ to Objects, that is, previous LINQ. It is mainly for the Clr-based objects query. That is, memory operation. Linq Enabled ADO. NET is for relational data. This also contains three parts. LINQ to Datasets, LINQ to Sql, LINQ to Entities. One of the familiar parts of LINQ to Sql is the previous dlinq. The official explanation is that LINQ to datasets, support for ado.net datasets; LINQ to SQL, support for SQL Server; LINQ to Entities, Support fro Entity Data Model. Remember, someone had previously asked about the relationship between DLinq and Ado.net orcas, because they were part of different team development, which had overlapping parts. Now, its functions come down together and the overlapping parts have been fused. (If someone is ado.net team or familiar with this, open up a column for us to talk about it.) The last part is called LINQ to XML, the previous xlinq. Operations on XML-formatted data. (And for ASP.net's blinq, ask aloud, does anyone understand this?)

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.