EF框架组件详述【Entity Framework Architecture】(EF基础系列篇3)

 

我们来看看EF的框架设计吧:

The following figure shows the overall architecture of the Entity Framework. Let us now look at the components of the architecture individually:

      

 

EDM (Entity Data Model): EDM consists of three main parts - Conceptual model, Mapping and Storage model.

Conceptual Model: The conceptual model contains the model classes and their relationships. This will be independent from your database table design.

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

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

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. You can use your LINQ skills here.

Entity SQL: Entity SQL is another query language 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 a main entry point for accessing data from the database and to return it back. Object service is responsible for materialization, which is the process of converting data returned from an entity client data provider (next layer) to an entity object structure.

Entity Client Data Provider: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.

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

 

EDM(Entity Data Model)【实体数据模型】:实体数据模型包含三个主要部分:概念模型,映射,存储模型;

Conceptual Model【概念模型】:包含模型类和类之间的关系。概念模型是独立于数据库设计的;

Storage Model【存储模型】:存储模型是数据库设计的实体,它包含数据表,视图,存储过程,还有他们之间的关系和键值;

Mapping【映射】:映射包含这个概念模型怎么映射到存储模型的信息;

LINQ to Entities:LINQ to Entities是查询语言,用来查询对象模型。它返回的是定义在概念模型中的实体;

Entity SQL:Entity SQL是另外的查询语言,就像LINQ to Entities一样,然而它和LINQ to Entities有一点不同,我们需要单独去学一下;

Object Service:Object Service是一个主要的切入点去从数据库中获取数据,并返回数据。Object Service负责将数据返回给Entity Client Data Provider实体对象结构;

Entity Client Data Provider:它主要的职责是将L2E(LINQ to Entity)或者Entity SQL查询语言,拼接成底层数据库可以理解的语言。它负责和ADO.NET Data Provider通信;

ADO.NET Data Provider:这个层,主要是用标准的ADO.NET和数据库打交道。

 

好了,EF的框架,差不多学到这里,相信大家已经有了一个基本的理解了。

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值