ADO. Net EF Start (2): Overview

Source: Internet
Author: User

Reprinted from:Http://www.cnblogs.com/ruciffa/articles/1087889.html

Background

I think for a long time, the three MS products will be a topic and a hot spot in the future. Is the ADO that will be released in VS 2008 SP1. NET Entity Framework, in. ASP. NET 4.0 to be released. net mvc, as well as the 2.0 version that has just been released, and will continue to evolve SilverLight. the first two will make up for the gaps on the MS product line, or some defects existing in the previous MS product, and the third will bring MS into the new RIA field.

The MS compensated by ADO. NET Entity Framework has never been involved in the persistent layer technology market. In terms of background, the persistence layer framework addresses the inconsistency between relational databases and program models. The program model is closer to our actual application. We need many models for us to use to simulate our business logic. We need encapsulation, polymorphism, combination, inheritance, and many-to-many relationships between program model entities. This object-oriented model that matches our daily lives and thinking patterns can better implement our business. However, our database is not object-oriented, and the database is relational. It cannot implement some relationships such as integration and combination in the object-oriented model. So when the development of the database is delayed and there is no breakthrough progress, we can only choose to use the persistent layer framework for intermediate conversion to eliminate the inconsistency between the database and our program model. On the java platform, Hibernate, as the most common persistent layer framework, has been developing for a long time. However, on the MS technology platform, apart from the NHibernate profile, there has been no framework for similar functions, which is the best for made in microsoft's ms in pursuit of any technology, it is undoubtedly quite uncomfortable.

ADO. NET Entity Framework is the Framework to be launched in this context. From ADO to ADO. NET, and then to ADOEF, MS has transformed the middle layer technology between programs and databases from lightweight tools to heavyweight frameworks, while the ease of use unique to MS remains.

ADO. NET Entity FrameworkComposition

The first is the Schema of modeling, which is used to connect the program model and the actual database model through the ing relationship.

1. Conceptual Schema (CSDL): used for modeling at the program level, directly establishing various object-oriented models

2. Storage Schema (SSDL): used to describe the actual situation in the database.

3. Mapping Schema (MSL): Used as the middle layer of the previous two layers to describe the ing between the two layers.

Then, access to the modeled data is provided.

1. Entity SQL: improved T-SQL statement

2. object Service: Provides. NET uses connection, command, data adapter, and dataset to access data. It is estimated that we should take care of the previous developers' access to ADO. NET.

3. linq to Entity

Finally, we provide the IDE tool, an Entity Designer, to easily create a model.

LINQ Technology

Many people think that. NET Framework 3.5 is actually a semi-finished product. The only enhancement from 4.0 to 3.0 is the release of the LINQ technology, the changes from 2.0 to 3.0 were far worse than those introduced in the past. The Open-ended WCF, WPF, WWF, Cardspace, and ASP. net ajax, C #3.0 and other technologies are quite innovative compared with previous versions. ADO. NET Entity Framework should be released in SP, while SilverLight is far from mature, ASP.. net mvc is still in beta version. It is possible that the finished version will be integrated in 4.0. NET Framework 3.5 is just a transitional product.

Speaking of the only evolutionary-LINQ technology, MS may be one step ahead of JAVA in this regard, previously, MS, which used data reading and writing as a tool-level small technology, began to treat it as a dedicated module in. Currently, LINQ includes the ability TO read and write data in the memory, the ability TO read and write data in XML files, and the ability TO write data in the memory. NET (Database-level read/write ). linq to ado. NET also includes three sub-modules: linq to DataSet (DataSet data read and write), linq to SQL (for SQL Server database read and write), and LINQ TO Entity.

In fact, linq to Entity is a direct read/write program model, which must be consistent with ADO. NET Entity Framework is used in combination, it reads and writes ADO. the program model modeled by the NET Entity Framework. The essence of linq to Entity is TO directly read and write ADO. NET Entity Framework data access method. It ignores the database layer and directly accesses the program model layer.

Many people have asked some questions, for example, why can't I implement inheritance by using linq to SQL, multi-Table combination, and many-TO-many relationships? How can I implement these complex relationships. In fact, from the design perspective, we cannot implement these functions by using linq to SQL. What truly achieves these relationships is ADO. NET Entity Framework and LINQ to Entity.

Linq to SQL does not support multi-Table inheritance, including an inheritance system for an entity-specific table and an inheritance system for an entity-extended table. Only the inheritance of a single table is supported. A single database table is used TO store data of all objects in the entire inheritance system, in short, it is to generate the inheritance of different classes based on the same attribute. As a tool-level technology, linq to SQL enables lightweight and fast database access development. Generate the corresponding Entity Class for the database. However, if you want TO implement more complex mappings and inheritance relationships, you can only use the predefined ADO. NET Entity Framework and linq to Entities.

ADO. NET Entity Framework is not included in the current VS 2008 RTM version. It may be released as the Service Pack of VS in 2008. It is an ORM-level Framework, currently, we can implement more complex relationships such as inter-TO-minus ing, Entity Inheritance, and Single Entity From Multiple Tables that cannot be implemented by LINQ to SQL.

The difference between the two lies in that when you use LINQ to SQL, your ing produces CLR /. NET classes are tightly coupled or bound to your data/database model. If you change the object model, you must directly modify these classes. Similarly, if the data model changes, you need to re-generate the object code, while ADO. NET Entity Framework creates a conceptual/Entity layer on the data/database model. This requires you to first define the conceptual/Entity layer, and then create a script (description) for the data/database ), then, you can create a logical ing between your entities and data in the photo and video layer, which makes the business and data sources highly compatible and isolated. However, this effect cannot be achieved by using LINQ to SQL. Therefore, the joint use of LINQ to Entities and ADO EF can provide entity inheritance, entity combination, and so on.

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.