Please note, this is a STATIC archive of website www.javatpoint.com from 19 Jul 2022, cach3.com does not collect or store any user information, there is no "phishing" involved.
Javatpoint Logo
Javatpoint Logo

Entity Framework Architecture

The components of an entity framework architecture are given below:

Entity Framework Architecture

EDM (Entity Data Model): EDM consists of three parts. These three parts are:

Conceptual Model, Mapping, and Storage Model.

Conceptual Model: The conceptual model contains the modal classes and their relationships. The conceptual model is independent of the database design table.

Storage Model: The storage model is the database design model which includes tables, views, stored procedure, their relationships, and keys.

Mapping: Mapping consists the information about how the conceptual model is mapped to the storage model.

LINQ-to-Entities: LINQ-to-Entities (L2E) is a query language that is used to write queries against the model of the object. It returns the entities, which is defined in the conceptual model. We can use our LINQ-to-SQL skills here.

Entity SQL: Entity SQL is another query language (for EF 6 only), just like LINQ to Entities. However, it is a little more difficult than L2E, and the developer will have to learn it separately.

Object Service: Object Service is the main entry point for accessing the data from the database and return it. Object Service is responsible for materialization, and materialization is the process of converting the data returned from an entity client data provider to an entry object structure.

Entity Client Data Provider: The main responsibility of this layer is to convert the LINQ-to-Entities or Entity SQL Queries into a SQL Query, which is understood by the database. It communicates with the ADO.NET data provider, which in turn sends or retrieves the data from the database.

ADO.NET Data Provider: This layer communicates with the database using the Standard ADO.Net.

Context Class in Entity Framework

Context Class is the most important class while working with the EF 6 or EF Core. It represents a session with the underlying database using the CRUD (Create, Read, Update, and Delete) operations.

The context class in the Entity Framework is a class that is derived from the 'System.Data.Entity.DbContext' in EF6 and EF Core both. An instance of the context class represents the Unit of Work and Repository pattern, where it can combine multiple changes under a single database transaction.

The context class is used in the query to save the data in the database. It is also used to configure the domain classes, database-related mappings, change tracking settings, caching, transactions, etc.

The following SchoolContext class is an example of a context class.

In the above example, the SchoolContext class is derived from DbContext, which makes it a context class. It also includes an entity set for Student,StudentAddress,and Grade entities







Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA