这是"最"数据访问框架/ C#和.NET的做法?
(编辑:我做了一个社区维基,因为它更适合于协作格式)
( I made it a community wiki as it is more suited to a collaborative format.)
有过多的方法可以从.NET访问SQL Server等数据库。都有自己的优点和缺点,它永远不会是一个简单的问题,这是最好的 - 答案永远是这取决于
There are a plethora of ways to access SQL Server and other databases from .NET. All have their pros and cons and it will never be a simple question of which is "best" - the answer will always be "it depends".
不过,我要寻找的一处的不同的方法和框架,不同层次的系统的范围内较高水平的比较。例如,我可以想象,对于一个快速和肮脏的Web 2.0应用程序的答案是从内部的企业级的CRUD应用程序有很大不同。
However, I am looking for a comparison at a high level of the different approaches and frameworks in the context of different levels of systems. For example, I would imagine that for a quick-and-dirty Web 2.0 application the answer would be very different from an in-house Enterprise-level CRUD application.
据我所知,有对堆栈溢出处理这个问题的子集众多问题,但我认为,试图建立一个简要的比较将是有益的。我会努力,因为我们去更新与更正和澄清的问题。
I am aware that there are numerous questions on Stack Overflow dealing with subsets of this question, but I think it would be useful to try to build a summary comparison. I will endeavour to update the question with corrections and clarifications as we go.
到目前为止,这是我的理解在一个较高的水平 - 但我相信这是错误的... 我主要专注于微软办法保持这种专注。
So far, this is my understanding at a high level - but I am sure it is wrong... I am primarily focusing on the Microsoft approaches to keep this focused.
- 数据库无关
- 好,因为它允许交换后端进出
- 坏,因为它可以击中性能和数据库厂商都不太乐意了
- 似乎是MS的preferred航线的未来
- 在复杂的学习(虽然,见267357)
- 在它通过 LINQ到实体访问,以便提供ORM,从而使抽象在$ C $ ç
- Database agnostic
- Good because it allows swapping backends in and out
- Bad because it can hit performance and database vendors are not too happy about it
- Seems to be MS's preferred route for the future
- Complicated to learn (though, see 267357)
- It is accessed through LINQ to Entities so provides ORM, thus allowing abstraction in your code
- 在不确定的未来(见是的LINQ to SQL真的死了吗?)
- 易学(?)
- 只有MS SQL Server的工作原理
- 也Pros和LINQ 的利弊
- Uncertain future (see Is LINQ to SQL truly dead?)
- Easy to learn (?)
- Only works with MS SQL Server
- See also Pros and cons of LINQ
- 没有ORM
- 在不抽象,所以你又回到了滚你自己,并以动态生成的SQL 玩
- 直接访问,可以让潜在更好的性能
- 这关系到是否把重点放在对象或关系型数据由来已久的争论,对此当然,答案是这取决于那里的大部分工作是,并因为这是一个无法回答的问题,希望我们不必去到太多。恕我直言,如果您的应用程序主要是操作大量的数据,这是没有意义的抽象太多入前端code对象,你最好使用存储过程和动态SQL做尽可能多的上的后端的工作成为可能。然而,如果你主要是有用户交互导致数据库的交互在几十或几百行的水平,那么ORM使得完整意义上的。所以,我想我的论点的老式的ADO.NET会在你操纵和修改大型数据集的情况下,在这种情况下,你会从直接访问后端获益。
- 在另一种情况,当然,在这里你要访问一个已经把守的存储过程的遗留数据库。
有超过标准的ADO.NET这些东西完全不同或只是一个层? - ?你真的使用这些,如果你有一个DAL或者如果你实现LINQ或实体
Are these something altogether different or just a layer over standard ADO.NET? - Would you really use these if you had a DAL or if you implemented LINQ or Entities?
- 似乎是一个非常强大的,功能强大的ORM?
- 开启源
其他的一些相关的链接; NHibernate的或LINQ到SQL 实体框架VS LINQ到SQL
Some other relevant links; NHibernate or LINQ to SQL Entity Framework vs LINQ to SQL
我想的LINQ to SQL有利于针对SQL Server的项目。
I think LINQ to SQL is good for projects targeted for SQL Server.
ADO.NET实体框架是更好,如果我们的目标是不同的数据库。目前,我想了很多供应商都可以ADO.NET实体框架,提供针对PostgreSQL,MySQL和ESQL,Oracle和其他许多(检查的 http://blogs.msdn.com/adonet/default.aspx )。
ADO.NET Entity Framework is better if we are targeting different databases. Currently I think a lot of providers are available for ADO.NET Entity Framework, Provider for PostgreSQL, MySQL, esql, Oracle and many other (check http://blogs.msdn.com/adonet/default.aspx).
我不希望使用标准的ADO.NET了,因为这是在浪费时间。我总是去ORM。
I don't want to use standard ADO.NET anymore because it's a waste of time. I always go for ORM.