ADO.NET Entity Framework and NHibernate - when to use one over the other

I work in a Microsoft.NET store where it is normal to use NHibernate or ADO.NET EF. What guidance should we use when you should choose one?

For example, it seems that when you write your Silverlight application EF -to-> ADO.NET Data Services -to-> Silverlight will offer a performance boost and provide you with a REST API without any extra effort.

What other things should help you with an app-based app?

UPDATE (based on comment): This is a little useful. What makes Nhibernate different from other ORMs? others go into strange tangents (like SubSonic) and don't compare them directly. I assume that I am specifically looking for people who use both, and decide on a project for the project that they will use.

+5
orm entity-framework nhibernate
Apr 08 '09 at 21:42
source share
3 answers

In short, EF does not support Persistence Notorance out of the box. When I first tried to create a solution with EF last year, I was a little annoyed that you cannot have POCOs in your application. I needed a higher degree of isolation from my model, so I switched to NHibernate. Since then, someone wrote an EF POCO adapter. http://code.msdn.microsoft.com/EFPocoAdapter - however, it is really just a code generator that generates an adapter layer to map your objects.

For some reason, my application runs faster on NHibernate. Take this with salt because I was new to customizing any solution.

+6
Apr 08 '09 at 22:41
source share

Microsoft recently started developing a new solution called .NET Ria Services (for now) that will be "ORM independent" to retrieve data from and from Silverlight from the server-level business logic.

They publicly mentioned (on slides in MIX, even) that NH WILL will be supported here.

If you're looking for a solution that supports most communities, NHibernate is definitely the answer. I agree that he has a steep learning curve, but in my experience it is definitely worth it. Just do a comparative search for "entity framework" and "nhibernate" and you will understand what I mean. Most EF material will โ€œpush,โ€ while NHibernate will actually have specifications. And questions. The answer to the question.

But, as other posters have said, I'm sure the Entity Framework will improve over time. So far, I believe that they are trying to solve too many problems with one set of tools. NHibernate does only one thing, but it does exceptionally well.

There is also the problem of application design. It seems that EF (in its current incarnation) is built to deliver the database to a C # application. NHibernate goes the other way and makes getting an object model easier.

+4
Apr 08 '09 at 23:02
source share

I would probably avoid the entity framework altogether. There is a vote of no confidence that the assignment was given, not to mention that it is not as mature as NHibernate.

Having said that, I will continue to evaluate the structure of the entity, as I am sure that it will be improved over time.

+2
Apr 08 '09 at 22:56
source share



All Articles