EF framework learning journey

1. What is Entity Framework

         The ORM tool officially provided by Microsoft. ORM allows developers to save code time for database access and spend more time on business logic layer code. EF provides change tracking, unique constraints, lazy loading, querying things, etc. Developers use Linq language, which saves trouble for database operations as much as for Object objects.

         EF has three usage scenarios, 1. Generate Class from the database, 2. Generate the database table structure from the entity class, 3. Design the database through the database visual designer, and generate the entity class at the same time.

What is O/RM?

          ORM is a tool that automatically maps data storage from domain objects to relational databases. ORM mainly includes three parts: domain objects, relational database objects, and mapping relationships. ORM enables classes to provide automated CRUD, freeing developers from database API and SQL.

Two, Entity Framework architecture

          DM (Entity Data Model): EDM includes three models, conceptual model, mapping and storage model.

         Conceptual model: Conceptual model contains model classes and the relationships between them. Independent of the design of the database table.

         Storage model: The storage model is a database design model, including tables, views, stored procedures and their relationships and keys.

        Mapping: Mapping contains information about how to map the conceptual model to the storage model.

LINQ to Entities: LINQ to Entities is a query language for writing queries against the object model. It returns the entities defined in the conceptual model.

Entity SQL: Entity SQL is another language similar to L2E, but it is much more complicated than L2E, so developers have to learn it separately.

Object Services: It is the access entry to the database, responsible for data materialization, from client entity data to database records and the conversion from database records and entity data.

Entity Client Data Provider: The main responsibility is to convert L2E or Entity Sql into SQL query statements that the database can recognize. It uses Ado.net communication to send data to the database to obtain data.

ADO.Net Data Provider: Use standard Ado.net to communicate with the database

Three, Entity Framework operating environment

EF5 consists of two parts, EF api and .net framework 4.0/4.5, while EF6 is an independent EntityFramework.dll and does not depend on .net Framework. Use NuGet to install EF.

Guess you like

Origin blog.csdn.net/yanghezheng/article/details/114205042