📜 ⬆️ ⬇️

NHibernate vs. Entity Framework 4.0

This question is asked to me very often, and I always tried to avoid a direct answer, but still I was asked about it so often that I feel that I simply have to answer. In general, I am more inclined towards NHibernate, so when you read this article, please keep this in mind.

EF 4.0 has fixed a lot of problems that exist in the previous version of EF. Things like transparent lazy loading , POCO classes , code only , etc. EF 4.0 is clearly much nicer than EF 1.0.

The problem is that EF is still a very young product. All changes that were added to version 4 only touched the surface. I already wrote about some of my problems with the POCO model in EF and Code Only , so I will not repeat. Judging by the problems I described, the main difficulty is that there is a wall between the community experience and what Microsoft does. Both of these cases show typical problems we encountered in NHibernate and Fluent NHibernate. These issues were addressed and resolved in NHibernate, but appear in EF.

Nevertheless, even ignoring the problems I have considered, there are other signs that NHibernate is a mature product. I understood this when I wrote the Entity Framework Profiler manual; there are things that you simply cannot do with EF, but which are a natural part of NHibernate.
I will not try to create a list of differences by points. We consider those cases where there are significant differences between the capabilities of NHibernate and EF 4.0. These are mainly differences in the possibilities of fine-tuning what the framework does. Typically, these are settings that allow you to achieve greater system performance without compromising the use of OR / M
')
So, here is a short list:
However, on the other hand:

From the translator: I myself am currently involved in a small ASP.NET MVC2 + Entity Framework 1.0 project. With other OR / M did not work, so it became interesting to compare NHibernate vs. Entity Framework. The opinion of those who worked closely with both OR / M (or others) is interesting - did Mr. Oren Eini correctly write everything? Do you have anything to add, correct?

Source: https://habr.com/ru/post/89778/


All Articles