为什么我们使用实体框架 [英] why we use entity framework

查看:68
本文介绍了为什么我们使用实体框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么我们使用实体框架?与ado.net相比,它有什么好处。实体框架也来自ado.net。最重要的是什么?

解决方案

实体框架允许您将表(或已定义的一般数据库实体,可以是多个表的组合)视为POCO类,操作它们与普通对象,设置属性,添加到集合等的方式一样,它抽象出所有数据访问代码,因此您不必编写它。这意味着您不需要了解任何有关SQL的内容或编写任何SQL代码,只需操作提供给您的对象。


实体框架是一个对象关系映射(ORM)。它是域对象(业务逻辑)和---& gt;之间的桥梁。 RDBMS是关系数据库管理系统,它将数据作为关系表存储,尽管平面数据库更加灵活和结构化。

EF提供访问(选择)和操作(删除,插入,更新)的自动化过程如果没有在数据访问层中编写太多代码行,在ADO.NET中我们必须编写TSQL代码,用于我们必须对DB {insert into table()values()}或{update table set field1 = value1,... ID =?或者{从表中删除ID =?}

假设你有很多字段,你必须为每次插入删除和更新手动编写代码,这样才需要花费很多时间。





----------------------------

FYI低于链接



http:// www。 technical.cosmicverse.info/ [ ^ ]

实体框架首先提供两种类型的绑定数据库和代码优先,考虑到你自己陷入了一个你不知道将来可以使用的数据库的情况,所以这里有一个解决方案Code第一种方法,它非常简单和容易,在维护或添加额外字段方面也很棒。当您不确定正在构建的内容并且不断更改功能时,它会派上用场。



我不是很确定它可以有效地处理大型数据库但是对于较少的记录你可以使用entityframework


Why we use entity framework? what its benifits as compared to ado.net. entity framework also derived from ado.net. So whats benefits are?

解决方案

Entity Framework lets you treat tables (or general database entities you have defined which can be a combination of multiple tables) as POCO classes, manipulating them the way you would normal objects, setting properties, adding to collections etc, and it abstracts away all the data access code so you don't have to write it. It means you don't need to know anything about SQL or write any SQL code, just manipulate the objects given to you.


Entity Framework is an Object Relational Mapping (ORM). It is a bridge between domain object (business logic) and ---> RDBMS is Relational DataBases Management Systems that stores data as relational tables in spite of flat database are more flexible and structured.
EF provides an automated process to access (select) and maniplation (delete , insert, update) without writing too much code lines in Data Access Layer , in ADO.NET we had to write TSQL codes for everything we must do with DB { insert into table () values () } or {update table set field1=value1 ,...where ID=? } or {delete from table where ID=?}
Assume you have many feilds and you have to write code manually for each inserting deleting and updating so it takes so much time.


----------------------------
FYI go trough below link

http://www.technical.cosmicverse.info/[^]


Entity frameworks offers two type of binding database first and code first, consider yourself you trapped in a situation where you don't know about the database you can use in future, so here is a solution "Code first approach", it is very simple and easy, also where it comes to maintaining or adding extra fields it is just awesome. Its comes handy when you are not sure about the things you are building and you keep changing the functionality.

I am not very sure it can efficiently handles huge database but for less records you can use entityframework


这篇关于为什么我们使用实体框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆