Entity Framework - Architecture

The architecture of Entity Framework, from the bottom up, consists of the following −

Data Providers

These are source specific providers, which abstract the ADO.NET interfaces to connect to the database when programming against the conceptual schema.

It translates the common SQL languages such as LINQ via command tree to native SQL expression and executes it against the specific DBMS system.

Entity Client

This layer exposes the entity layer to the upper layer. Entity client provides the ability for developers to work against entities in the form of rows and columns using entity SQL queries without the need to generate classes to represent conceptual schema. Entity Client shows the entity framework layers, which are the core functionality. These layers are called as Entity Data Model.

Entity Data Model
  • The Storage Layer contains the entire database schema in XML format.

  • The Entity Layer which is also an XML file defines the entities and relationships.

  • The Mapping layer is an XML file that maps the entities and relationships defined at conceptual layer with actual relationships and tables defined at logical layer.

  • The Metadata services which is also represented in Entity Client provides centralized API to access metadata stored Entity, Mapping and Storage layers.

Object Service

Object Services layer is the Object Context, which represents the session of interaction between the applications and the data source.

  • The main use of the Object Context is to perform different operations like add, delete instances of entities and to save the changed state back to the database with the help of queries.

  • It is the ORM layer of Entity Framework, which represents the data result to the object instances of entities.

  • This services allow developer to use some of the rich ORM features like primary key mapping, change tracking, etc. by writing queries using LINQ and Entity SQL.