In this article, we will discuss the Entity Framework Architecture
The ADO.NET Entity Framework is comprised of the following components:
- The Entity Data Model
- LINQ to Entities
- Entity Client
- Entity SQL
- The Object Services Layer
The Entity Data Model
The Entity Data Model abstracts the logical or the relational schema and exposes the conceptual schema of the data using a three-layered approach.
- The Conceptual Model (C-Space)
- The Mapping Model(C-S Space)
- The Store Model (S-Space)
The conceptual model contains the entities and their relationships. This will be independent from your database table design.
It defines your business objects and their relationships in XML files.
Mapping consists of information about how the conceptual model is mapped to the storage model.Mapping model is responsible for mapping the conceptual and the logical layers. It maps the business objects and the relationships defined in the conceptual layer with the tables and relationships defined in the logical layer
It represents the schema of the underlying database. This is comprised of tables, stored procedures, view,
LINQ to Entities:
LINQ to Entities is a query language used to write queries against the object model. It returns entities, which are defined in the conceptual model.
The main responsibility of this layer is to convert L2E or Entity SQL queries into a SQL query which is understood by the underlying database. It communicates with the ADO.Net data provider which in turn sends or retrieves data from the database.
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 SQL is another query language just like LINQ to Entities. These E-SQL queries are internally translated to data store dependent SQL queries. The conversion of the E-SQL queries to their data store-specific query language like T-SQL, is handled by the Entity Framework.
Object Services Layer:
Apart from querying the Conceptual Model, you might have to work with entities such as in-memory objects or a collection of in-memory objects. To do this you need Object Services.You can use it to query data, from almost any data store, with less code. In addition to from enabling you to perform CRUD operations,the Object Services Layer provides the following additional services:
- Change tracking
- Lazy loading
- Optimistic concurrency
- Merging data
- Identity resolution
- Support for querying data using Entity SQL and LINQ to Entities
We will discuss on Object services Layer in detail, in next articles.
Thanks for visiting !!