NHibernate、Entity Model 和 LightSpeed 哪个更好?
谁能说出哪一种最适合面向性能的应用程序?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
谁能说出哪一种最适合面向性能的应用程序?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
上述所有的。或者以上都不是。如果不衡量性能并看看哪一个适合或不适合你,就无法判断。
All of the above. Or none of the above. No way to tell without measuring performance and seeing which one does or does not work for you.
我同意这里现有的答案:在半途而废之前了解性能对您的应用程序真正意味着什么(我们大多数人都经历过)。如果您正在寻找一些超级性能的东西,但仍然具有一些“ORMish”行为,并从 ADO.Net 方程中取出一些猴子编码,请查看各种 .Net MicroOrms,例如:
还有其他几个,其中一些是从简洁的网站引用的。
如果你真的被这三个选择所困扰,那肯定取决于很多因素以及你花多少时间进行调整。话虽这么说,我已经经常使用这三个,尤其是 NHib 2-3 和 EF 4-6。我认为,如果您只是进行快速而肮脏的编码,而不花费大量时间进行优化,那么 LightSpeed 是一个非常好的选择,而且我个人发现,当涉及到最基本的 CRUD 操作时,它可以轻松地胜过其他两个和 LINQ 查询。
LightSpeed 的一大缺点是您必须从其基类继承。部分类支持可以在一定程度上缓解这种情况,您还可以在两者之间插入自己的基类,并且也没有真正的“CodeFirst”支持,尽管您可以手动编码类并跳过设计器(如果您愿意)。如果调整得当,它们都可以很好地工作。只需为工作选择合适的工具即可。
无论您选择哪一个,请使用 SQL Profiler / Mini Profiler / NProf / EFProf 等...
I would agree with the existing answers here: Understand what performance really means to your application before going off half-cocked on something (most of us have been there). If you're looking for something super-performant but that still has some "ORMish" behavior and takes some monkey coding out of the ADO.Net equation, take a look at the various .Net MicroOrms out there such as:
There are several others out there, some of which are referenced from the dapper site.
If you really are stuck with those three choices, it definitely does depend on a lot of factors and how much time you spend tuning. That being said, I've used all three quite a bit, especially NHib 2-3 and EF 4-6. I think if you are doing just quick-and-dirty coding without spending a lot of time on optimizing, LightSpeed is a really good choice and I've personally found it to outperform the other two very handily when it comes to most basic CRUD operations and LINQ queries.
The big downside of LightSpeed is that you have to inherit from their base classes. This is somewhat mitigated by partial class support and you can also insert your own base classes in between, and there's also no true "CodeFirst" support, although you can handcode the classes and skip the designer if you like. They all work well if tuned properly. Just pick the right tool for the job.
Whichever you chose, use your SQL Profiler / Mini Profiler / NHProf / EFProf etc...