优点和缺点,使用ADO.Net实体模型 [英] Pros and cons for using ADO.Net entity model

查看:207
本文介绍了优点和缺点,使用ADO.Net实体模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI

有哪些优点和缺点使用ADO.NET实体模型作为数据层?而且我应该使用LINQ如果我要使用这种技术?

What are the pros and cons for using ADO.NET entity model as a data layer? And should i use LINQ if i'm going to use this technology?

感谢

推荐答案

首先:你不必使用LINQ使用实体框架(EF),但它有一定的帮助。 EF是基于东西EF团队调用的实体SQL 的,还等什么,当你使用LINQ到实体真正发生的是,LINQ EX pressions被转换为实体SQL,它再次被转换为无论SQL方言数据库使用(T-SQL为SQL Server)。

First of all: you don't have to use LINQ to use the Entity Framework (EF), but it certainly helps. EF is based upon something the EF team calls Entity SQL, so what really happens when you use LINQ to Entities is that the LINQ expressions are being translated to Entity SQL, which again are translated to whatever SQL dialect your database uses (T-SQL for SQL Server).

利弊EF有点一个有争议的问题的,因为大多数人并不特别喜欢EF,但我会尽量保持中立。

Pros and cons for EF is a bit of a controversial subject as most people don't particularly like EF, but I will try to keep it neutral.

优点

  • 在加上的LINQ to SQL(L2S),LINQ到实体(L2E)和EF是目前最好的数据访问API,微软提供。尽管他们的缺点,他们的方式比传统ADO.NET大多数情况更好。
  • 虽然L2S比较简单,L2E已被标记为微软的数据访问API的未来,所以如果你想留在主流的微软API的滑流,你应该使用L2E。它看起来并不像L2S可以看到很多新的发展。
  • 在EF将得到相当的提升能力和灵活性,在.NET 4

缺点

  • 在与英法合作是的硬盘的。这是pretty的脆性,当涉及到架构更改,这是一个婊子更新它当底层架构更改
  • 在由EF生成的T-SQL是可怕的(虽然这应该改变.NET 4)
  • 在持久性无知是不可能的(直到.NET 4)
  • 在很多LINQ方法都没有实现,所以API是比较有限的比它的样子。
  • 在这几乎没有灵活的API为人们所希望
  • Working with EF is hard. It's pretty brittle when it comes to schema changes, and it's a bitch to update it when the underlying schema changes
  • The T-SQL generated by EF is horrible (although this should change in .NET 4)
  • Persistence Ignorance isn't possible (until .NET 4)
  • Lots of LINQ methods are not implemented, so the API is more limited than it looks like.
  • It's not nearly as flexible an API as one could wish

总之,使用它,如果你能什么烤成BCL只使用,或者,如果你在.NET 4中,给它一个尝试;否则,也有开源库的形式更好的选择。

In short, use it if you can use only what's baked into the BCL, or, if you are on .NET 4, give it a try; otherwise, there are better alternatives in the form of open source libraries.

这篇关于优点和缺点,使用ADO.Net实体模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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