I want to know few things about ASP.NET MVC with NHibernate.

  1. Is NHibernate the best ORM used with ASP.NET MVC?
  2. If so, will NHibernate slow down the application?
  3. What can be done to improve performance of an ASP.NET MVC application with NHibernate?
link|flag

What do asp.net mvc and an orm have in common? They are 2 totally different things. – Paco Dec 10 '09 at 10:13
@Paco - So what? – Mike C. Jan 21 at 23:05
@Mike C: The type of UI framework you build an application on has no influence on how an ORM is working for the applications. – Paco Jan 22 at 13:21
@Paco now i realize the fact... My question was a month back when i started mvc – Pandiya Chendur Jan 22 at 13:51

3 Answers

up vote 9 down vote accepted
  1. Depends. If you are a total newbie you might want to try entity framework because it contains all the ORM designer classes that allows you to create entity class by drag and drop.
  2. No, it won't. NHibernate is used by a lot of sites, and it has first and second level caching feature that would speed things up by caching the previous operation, so performance isn't really an issue.
  3. You can only improve your app after you identify the bottleneck. Don't premature optimize.
link|flag
1  
The Entity Framework is not for newbies (then again, no ORM is). – Michael Maddox Dec 10 '09 at 9:59
1  
Perhaps some Linq To Sql won't hurt.. – Black Horus Dec 11 '09 at 21:28

I use NHibernate with ASP.NET MVC for GarageCommerce.com and it is very fast even on pretty low budget hardware. The overhead of NHibernate is negligible compared to the raw cost of talking to a database.

There is a strong community, proven patterns to follow and support tools like NHibernate Profiler. It's likely that you would end up with a more efficient application than if you had rolled your own database access.

You have a better chance of solving scalability issues with a powerful tool like NH. You can turn on it's 2nd level cache and back it with memcache. There is also work on NHiberate.Shards to help you horizontally partition your data.

link|flag
Thanks micheal it was very useful – Pandiya Chendur Dec 10 '09 at 6:38
  1. There is no best ORM to use with ASP.NET MVC. The best ORM is the one which meets your needs.
  2. No, there is nothing inherent in NHibernate that will slow down your application.
  3. Don't worry so much about performance unless it becomes a problem in the future. Is there a good reason why you have such high performance requirements?
link|flag

Your Answer

 
or
never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.