ArticleDirectory
Introduction to Entity Framework
The Entity Framework is a set of data-oriented software applications in ADO. net.Program. Is An ORM framework of Microsoft.
What is o/R Mapping?
In a broad sense, Orm refers to the mutual conversion between the object-oriented object model and the data structure of relational databases.
In a narrow sense, Orm can be considered as a virtual Object-oriented Data access interface based on relational database data storage. Ideally, based on such an object-oriented interface, persistence of an OO object requires no understanding of the Implementation Details of any relational database storage data.
The three letters of ORM are shown in:
ORM in EF
The Entity Data Model (EDM) in EF is defined by the following three models and ing files with corresponding file extensions.
- Conceptual Architecture Definition Language file
(. CSDL) -- Define a conceptual model. R
- Storage Architecture Definition Language file
(. SSDL) -- Define the storage model (also called Logical Model O ).
- Ing standard language file
(. MSL) -- defines the ing m between the storage model and the conceptual model.
The Entity Framework uses these XML-based models and ing files to convert the creation, read, update, and delete operations on entities and relationships in the conceptual model to the equivalent operations in the data source. EDM even supports ing entities in the conceptual model to stored procedures in the data source.
As shown in the edmx definition:
Gateway used to operate databases in EF
Objectcontext encapsulates the connection between the. NET Framework and the database. This type is used as the gateway for "CREATE", "read", "Update", and "delete" operations.
The objectcontext class is the primary class used to interact with data as objects (the objects are Entity-type instances defined in EDM.
It encapsulates the connection from EF to the database and the set of objects corresponding to the table. Therefore, all our operations should be for the object set under objectcontext. After modifying the object set, you can call the savechange method of objectcontext to map operations on the object set back to the database. Of course, objectcontext uses the edmx definition above, that is, the XML definition of the relationship between tables and entities, generates corresponding SQL statements through set changes, and CALLS ADO.. Net to perform database operations.
As shown in:
Of course, the above is just a simple figure. The more professional figure should be like this, as shown in:
Through the above introduction, we basically realized the basic usage of entity freamwork. Of course, it is very simple. Hope to help beginners! Welcome to expert brick-making guide!
Link Navigation:
Entity Framework Quick Start-index stickers