What is Entity Framework?

EntityFramework是Microsoft提供的一个对象关系映射框架,它使开发者能够通过使用领域特定的对象而非直接编写ADO.NET代码来操作关系型数据。该框架支持LINQ查询,并提供变更跟踪、延迟加载等服务。

1.什么是EntityFramework?

http://www.entityframeworktutorial.net/what-is-entityframework.aspx

 

Writing and managing ADO.Net code for data access is a tedious乏味 and monotonous单调 job.

Microsoft has provided an O/RM[object relational mapping]对象关系映射 framework called "Entity Framework" to automate自动化 database related activities活动 for your application.

 

Microsoft has given the following definition of Entity Framework:

The Microsoft ADO.NET Entity Framework is an Object/Relational Mapping (ORM) framework that enables developers to work with relational data as domain-specific objects, eliminating消除 the need for most of the data access plumbing code that developers usually need to write. Using the Entity Framework, developers issue queries using LINQ, then retrieve and manipulate data as strongly typed objects. The Entity Framework's ORM implementation provides services like change tracking, identity resolution, lazy loading, and query translation so that developers can focus on their application-specific business logic rather than the data access fundamentals.

 

Entity framework is an Object/Relational Mapping (O/RM) framework.

It is an enhancement to ADO.NET that gives developers an automated mechanism for accessing & storing the data in the database.

 

Entity framework is useful in three scenarios.

First, if you already have existing database or you want to design your database ahead of other parts of the application.

Second, you want to focus on your domain classes and then create the database from your domain classes.

Third, you want to design your database schema on the visual designer and then create the database and classes.

The following figure illustrates the above scenarios.

 

As per the above figure, EF creates data access classes for your existing database, so that you can use these classes to interact with the database instead of ADO.Net directly.

EF can also create the database from your domain classes, thus you can focus on your domain-driven design.

EF provides you a model designer where you can design your DB model and then EF creates database and classes based on your DB model.

 

 

What is O/RM?

ORM is a tool for storing data from domain objects to relational database like MS SQL Server, in an automated way, without much programming.

O/RM includes three main parts: Domain class objects, Relational database objects and Mapping information on how domain objects map to relational database objects (tables, views & storedprocedures).

ORM allows us to keep our database design separate from our domain class design.

This makes the application maintainable and extendable.

It also automates standard CRUD operation (Create, Read, Update & Delete) so that the developer doesn't need to write it manually.

A typical ORM tool generates classes for the database interaction for your application as shown below.

 

Visit wikipedia for more information on Object-relational Mapping

There are many ORM frameworks for .net in the market such as DataObjects.Net, NHibernate, OpenAccess, SubSonic etc.

Entity Framework is an open source ORM framework from Microsoft.

Please note that Entity Framework is an open source framework by Microsoft.

You can contribute to the Entity Framework project oncodeplex.

目前最新的EntityFramework托管在github上,https://github.com/aspnet/EntityFramework

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值