实体框架vs NHibernate - 性能 [英] Entity framework vs NHibernate - Performance

查看:92
本文介绍了实体框架vs NHibernate - 性能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻求在我们的系统中实现ORM。我们目前拥有许多可怕数据和存储过程的表。我听说使用ORM可以减慢系统的速度。有没有人知道使用C#代码创建的查询和映射到存储过程的哪些ORM更好的速度和性能?



谢谢



编辑:



该项目将使用庞大的现有表,并包含大量数据,还将使用现有的执行复杂任务的存储过程在SQL Server数据库中。在运行现有存储过程并查询当前表时,ORM必须能够执行事务并具有高性能。该项目是基于Web的,将使用具有DDD的WCF Web服务。我可以看到,EF很容易使用,并有更大的支持,但如果NH是最合适的选项?

解决方案

实体框架不断实施新功能,一切都在您的项目中自动化。实体框架非常简单,扩展和重构代码。
Visual Studio集成了它(代码优先,数据库优先,实体优先),就像一个魅力。
Windows Azure易于部署和更改。
此外,Visual Studio可以在3次点击中生成所有CRUD页面。



我建议您使用EF,但这取决于您的项目。你可以给我们更多的细节吗?



你可以在Google上找到很多比较图表,例如这个解释了性能和这一个差异。



编辑:



您可以量化应用程序中的用户数量吗?



当您在EntityFramework中使用Database-First时,很容易导入和使用存储过程,for NHibernate它也相当简单
请注意,如果您使用大量存储过程,并且不是很多并发用户,那么这两者之间的CRM选择可能并不重要。



也不要忘记,一个工具的性能往往是基于使用它的方式。如果您滥用ORM(例如异步,懒惰/渴望加载,基础类,...),性能将大幅下降。



也许您可以安装它们,看看他们如何工作并检查他们的路线图(例如实体框架)来检查演进和兴趣。 / p>

I am looking to implement an ORM into our system. We currently have many tables with lots of horrible data and stored procedures. I've heard using an ORM can slow the system down. Does anyone know which ORM is better on speed and performance using Queries created in the C# code and mapping to stored procedures?

Thanks

EDIT:

The project will use existing tables that are large and contain a lot of data, it will also use existing stored procedures that carry out complex tasks in a SQL Server DB. The ORM must be able to carry out transactions and have high performance when running the existing stored procedures and querying the current tables. The project is web based and will use WCF web services with DDD. I can see that EF is a lot easier to use and has greater support but if NH the most suitable option?

解决方案

The Entity Framework is constantly implementing new features and everything is automated in your project. It is very easy to use Entity Framework, extend and refactor your code. Visual Studio integrates it (Code-First, Database-first, Entity-First...) like a charm. Windows Azure makes easy to deploy and change it. Moreover Visual Studio can generate all your CRUD pages in 3 clicks.

I would suggest you use EF but it depends of your project. Can you give us more details about it?

You can find lots of comparison charts on Google, for example this one explains performance and this one differences.

EDIT:

Can you quantify the number of users in your application?

When you use Database-First in EntityFramework it is very easy to import and use stored procedures, for NHibernate it quite simple as well. Note that if you use a lot of stored procedures and not a lot of simultaneous users the choice of a CRM between those two may not be so crucial.

Also don't forget the performance of a tool is often based on the way to use it. If you misuse the ORM (e.g. async, lazy/eager loading, base classes, ...) the performance will drastically drop.

Perhaps you can instal both of them, look at how they work and check at their roadmap (e.g. Entity framework) to check at the evolution and interest.

这篇关于实体框架vs NHibernate - 性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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