Mahesh
Mahesh

Reputation: 1784

Entity Framework 4.1 VS Nhibernate, for noob in ORM

I am in process of evaluating ORM first time. Please suggest which one i should choose for my next project.

I wrote couple of sample code with EF 4.1 code first. Before start same exercise with Nhibernate, I want to know if somebody have already experience with both in production application.

My evaluating criteria

  1. Speed of database access
  2. Learning curve (because I am new to ORM)
  3. Community support
  4. Tutorial/Books availability
  5. Anything else which I should consider (Because I am noob to ORM)

I wish if people who have experience with both the ORM in production level app answer my question.

Thanks in advance!!!

I am aware that this question may be a little bit dangerous to ask ;)

Upvotes: 4

Views: 1494

Answers (3)

PinnyM
PinnyM

Reputation: 35541

Having used EF 4.1 and Castle ActiveRecord (based off NHibernate), I would rate them as follows:

Speed of DB access - NHibernate for anything remotely complex, otherwise about the same. The problem with EF is that it creates such convoluted SQL that it's difficult to know how to optimise it or if it's even possible to do so.

Learning curve - I personally found EF easier to get started with, but others may feel differently, and both certainly have a learning curve.

Community support - Depends on what you mean by 'support'. You'll find lots of info on the web (and this site) for both. NHibernate is open source, while EF is controlled by MS.

Tutorials/Books - I believe there are more 'official' resources available for EF at this time, but searching on forums will likely get you what you can't find in books.

Anthing else - Realize that the purpose of ORM's is to simplify the data access layer for the developer. However, both of these ORM's (and pretty much every other heavyweight ORM) expect you to use certain coding patterns for this simplification to be realized. While coding pattern enforcement isn't a Bad Thing (some would argue that it's a must), it's something you certainly need to prepare for before choosing one.

Upvotes: 6

Richard
Richard

Reputation: 22036

If you are a noob to ORM and only need the basic features you may find the Entity Framework and Nhibernate are over kill and should be looking at a light weight one like Massive:

https://github.com/robconery/massive

That said there are two main issues you face with EF vs NH

  1. EF is all that microsoft support and so all their tooling by default uses EF. Making beginner code easier with EF.
  2. NHibernate is more mature and has a greater feature set (if you need it) also has a good development community and lots of blog info about it.

I would choose Massive if you want simple / fast but unsupported, EF if you want easy and MS support but limited in some ways, or NHibernate if you have the time to learn a proper ORM.

Hope this helps.

Upvotes: 3

Luis Tellez
Luis Tellez

Reputation: 2993

Well im my personal experience Nhibernate have been the right choice, in complex situation have given me better time results, and it was a lot easier to learn.

I learned it first and then tried the Entity Framework and I found it easier to learn nhibernate Even though in that moment i didn't knew anything about ORM.

Community support and Tutorials and books I can say they are both good and have a lot of material to learn from.

Now I can use them both but still likes Nhibernate a lot more.

Upvotes: 1

Related Questions