Entity Framework Quick Start

Source: Internet
Author: User
ArticleDirectory
    • What is o/R Mapping?

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

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.