简体   繁体   English

在.net Core应用程序中从数据库(实体框架或Ado.Net)获取数据的最佳方案是哪一种?

[英]Which is the best Scenario for getting data from Database (Entity Framework or Ado.Net) in a .net Core application?

我开始在.net Core上工作,因此哪种方法是使用Entity Framework或Ado .Net从数据库中获取数据的最佳方法?

Actually Entity Framework is build at the top of ADO.NET so it can't be faster. 实际上,实体框架是在ADO.NET的顶部构建的,因此它不可能更快。 But it makes development much faster. 但这使开发速度大大提高。 And improves maintainability of your code. 并提高代码的可维护性。 I mean the power of LinQ queries with EF requires you to write less code.code is auto generated whereas Ado.net code is larger than Entity Framework.Entity Framework is a wrapper for ADO.NET. 我的意思是说,借助EF的LinQ查询的功能需要您编写更少的代码。代码是自动生成的,而Ado.net代码比Entity Framework大.Entity Framework是ADO.NET的包装器。 Thus there is nearly no difference between those two in performance (maybe entity framework is a bit slower). 因此,两者之间的性能几乎没有区别(也许实体框架要慢一些)。

If you want to know the details, managing connections, CRUD, and so on, Ado.Net is as good a place to start as any. 如果您想了解详细信息,管理连接,CRUD等,Ado.Net就是一个很好的起点。 Once you learn that, you'll probably pick up EF more quickly. 了解了这一点之后,您可能会更快地使用EF。

In the end, everything uses SQL at some level. 最后,一切都在某种程度上使用了SQL。 If you're familiar with SQL you'll find it easier using any db framework 如果您熟悉SQL,则会发现使用任何数据库框架都更轻松

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM