Entity Framework Introduction

ORM: Object Relation Mapping Object-Relational Mapping, the operation target of the operation by way of the database.

Basics: linq and ado.net.

EF is an open-source development for .NET ORM framework.

It works between business entities (domain class) and a database that holds data entity attributes in the database, the data may be retrieved from the database and automatically converts it into solid objects.

EF composed of simple summary:

1. the EDM (Entity Data Model)

① conceptual model (Conceptual Model): conceptual model includes the relationships between classes and their models. It will be independent of the database table design.

② Mapping (Mapping): Mapping the conceptual model of how information is mapped to the storage model components.

③ storage model (Storage Model): model storage model database design, including tables, views, stored procedures, and the relationship between them and the key.

2. the LINQ the To the Entity (L2E) : L2E entity object is a query language, it returns the entity defined in the conceptual model.

3. the Entity SQL : L2E similar to the Entity SQL is a query language. However, it is more complex than L2E.

4. ObjectServices (Object Services): data access service objects in the database and return to the main entry point data. It is responsible for instantiating data, converts Entity Client Data Provider (lower level) data into the entity object.

5. The the Entity the Data Provider Client: main functions is to convert into L2E or the Entity Sql Sql database query can identify, request, or it sends the data to the database through ADO.Net Data Provider.

6. The ADO.Net the Data Provider: using standard Ado.net communicate with the database.

 

Creating order:

We need to create a database model classes and use EF Database development, according to the order of creation:

1.DataBase First (priority database): create database tables, and then automatically generate the files EDM, EDM file generation model classes.

2.Model First (model priority): first create a file EDM, EDM file is automatically generated model classes and database.

3.Code First (code first): programmers write their own model class, and then automatically generate the database, no EDM.

 

We recommended CodeFirst.

Guess you like

Origin www.cnblogs.com/1016391912pm/p/12014456.html