Help me choose NHibernate for my next project

86 views
Skip to first unread message

Joel

unread,
Mar 21, 2012, 7:36:32 AM3/21/12
to nhusers
Greetings all. I'm new to .net and I have a new project starting and
I'm concidering using NHibernate as it seems like the mature way to
go, but I have some things that still kind of scare me in regards to
starting to use NH, help me get over my issues:

1. The learning curve is massive (I come from Grails, where Hibernate
was extremely well wrapped). I found very little in regards to guides
and tutorials.

2. I got the impression that using database first would be difficult,
I found no tutorials! I have always done migrations with simple .sql
scripts and helper apps I wrote myself.

3. If I don't use database first and my db changes, I might lose my
data? How does migration using code first work?

4. The user base is shrinking? This group got 900+ msgs in feb'09,
800+ msgs in feb'10, 550+ msgs in feb'11 and now only 130+ msgs in
feb'12! I hope this is because users migrated somewhere else to
discuss but this is scary as I will need help from time to time.

Currently I'm caught in limbo thinking it might be easier if I just
wrote the sql statements myself with simple classes and wiring them
together using duct tape - but it really, really looks like ASP.net
MVC 3 apps are meant to be used with an ORM.

My databse will be quite simple, <20 tables with 1-1 and 1-n relations
only. Point me to a starting point

Belvasis

unread,
Mar 21, 2012, 12:18:02 PM3/21/12
to nhu...@googlegroups.com
Hi Joel,


1. The learning curve is massive (I come from Grails, where Hibernate
was extremely well wrapped). I found very little in regards to guides
and tutorials.


I think, the learning curve for NH is not that massive. But i think this depends on
your general knowledge. There are a lot of guides and tutorials out there. I can
recommend the two books "NH in Action" and "NH Cookbook". The nhforge.org
site has a (nearly) complete documentation and some good blog posts. Fabio's
blog at http://fabiomaulo.blogspot.de/ has also a lot of informations about NH
and at http://ayende.com you can also find helpful informations. And i think
you can find a lot more.
 
2. I got the impression that using database first would be difficult,
I found no tutorials! I have always done migrations with simple .sql
scripts and helper apps I wrote myself.


In my last projects i always used an DB first approach, mainly because I
had to work with an existing database. I don't think it is that difficult to map
entities against an existing DB schema.

4. The user base is shrinking? This group got 900+ msgs in feb'09,
800+ msgs in feb'10, 550+ msgs in feb'11 and now only 130+ msgs in
feb'12! I hope this is because users migrated somewhere else to
discuss but this is scary as I will need help from time to time.


Yes, in the last months it was a little quite around here. I think this is because 
some of the guys like Fabio are no longer involved in the project. But thats
just an assumption. Today it is a lot better and there are many people who
are willing to answer your questions. And since the new 3.3 release is on it's
way, one can see that the project is still alive.  
 
 
Currently I'm caught in limbo thinking it might be easier if I just
wrote the sql statements myself with simple classes and wiring them
together using duct tape - but it really, really looks like ASP.net
MVC 3 apps are meant to be used with an ORM.


There are for sure cases, where NH is to big to solve a problem. But in
most cases it helps a lot and for MVC apps it is as far as i can see
the best solution.   
 
My databse will be quite simple, <20 tables with 1-1 and 1-n relations
only. Point me to a starting point


Maybe EF CodeFirst would be an alternative to NH in this case, but there
a lot of comparisons between EF and NH that show, why NH is still the
better choice. 

Hope this helped a little :-)
 
--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To post to this group, send email to nhu...@googlegroups.com.
To unsubscribe from this group, send email to nhusers+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.


Patrick

unread,
Mar 21, 2012, 8:18:31 PM3/21/12
to nhu...@googlegroups.com
Since I've just recently started using nHibernate, I'll add my two cents.  The learning curve is not that bad because the community is good, the documentation is decent, and there are a lot of good samples available.  I have had some difficulty with mapping by code since the documentation still deals mainly with XML-based configuration, but part of my issue was unfamiliarity with Lambda expressions and other concepts (never used an ORM before).  For someone more experienced, I doubt it would be too much trouble.

I definitely have been developing DB first and it hasn't presented any problems.  For a new system I'm working on, I have a separate DB project that generates SQL scripts but isn't connected to nHibernate in any way.  Very easy.  I even have some very customized stored procedures that I use through nHibernate, which were also very easy to setup.  You can return full, managed entities or just report-type DTOs.

We evaluated EF as an alternative but found that it just wasn't quite as good.  And honestly, once you get into more complicated scenarios, I can't imagine the learning curve for EF being any better.  I was worried at first that nHibernate would be too complicated to learn in a short amount of time but it appears that fear was unfounded.

-Patrick
Hi Joel,

To unsubscribe from this group, send email to nhusers+unsubscribe@googlegroups.com.

JoelP

unread,
Mar 22, 2012, 8:28:58 AM3/22/12
to nhu...@googlegroups.com
Thank you for your reply, this helped me a lot! This was exactly the kind of information I was looking for to get my bearings straight.

Thanks again!

Fabio Maulo

unread,
Apr 7, 2012, 5:43:27 PM4/7/12
to nhu...@googlegroups.com
The number of message decrease because what increase is the number of people with a good knowledge of an "old" framework.
Don't be scared... the last release of NH (3.2.0) have the download record in the NH's history. 

Jeffry Morris

unread,
Apr 10, 2012, 6:08:15 PM4/10/12
to nhu...@googlegroups.com
The barrier to entry really isn't too high anymore. I have had really good success with FluentNHibernate, conventions to map to existing databases. The documentation is pretty poor/scattered/outdated/missing, but there are enough user's that finding what you need is pretty simple - somebody has already stumbled and solved the problem. I am pretty sure Nuget has even made it easier to get up and running.

Also, buy the cookbook...lot's of recipe's.

-Jeff

--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To view this discussion on the web visit https://groups.google.com/d/msg/nhusers/-/nJqBtgPHZsAJ.

To post to this group, send email to nhu...@googlegroups.com.
To unsubscribe from this group, send email to nhusers+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages