Can you point me to current examples using NHibernate in an ASP.NET MVC2 app? - nhibernate

Can anyone point me to any self-contained, complete, current reference materials/projects using NHibernate in an ASP.NET MVC2 application?
I have looked at Sharp Architecture, but I am not sure I need the complexity in that project. I certainly don't know enough about it to know if it is over-engineered for my purposes.
I would like to see more types of implementations to gauge the various ways people have skinned this cat.

This video series on nHibernate is great and they are using MVC Storefront as the base for the work:
http://www.tekpub.com/production/nhibernate
Code is here:
http://github.com/robconery/Kona
Another great MVC Resource (if you need one) is their MVC Videos:
http://www.tekpub.com/production/aspmvc
and
http://www.tekpub.com/production/byob
I can't recommend them enough.
Max Schilling

Gave it to Max for just answering. :)
But, for the record, here's additional apps to consider, should you end up here:
Sharp Architecture (the Northwind app
is okay but lean, not typical
enterprisey stuff)
Who Can Help Me? (great stuff and
kept up-to-date)
FubuMVC has good sample apps (based
on MVC not MVC2 at the time of this
post)
Thanks.

Related

Reference NHibernate application for ASP.NET

I've seen the question for MVC ASP.NET, but was wondering if there was a solid implementation for ASP.NET? Anyone know of a web app with a solid implementation of NHibernate that doesn't have odd crashes to look at?
Kind of a vague question, and I can't provide you with an application you can look at yourself, but I can assure you that the company I work at have built several applications using NHibernate with or without ASP.NET MVC (if not using MVC, we're using WebForms). I can't really see why using MVC or not would make NHibernate less reliable than in any other setting. And NHibernate is usually very reliable, in my opinion.
Having said that, there's plenty of gotchas when setting up the infrastructure for NHibernate the first time, so that might be the problem in your case.
Please ask some more specific questions about the issues you have, for example including stack traces of the crashes you're seeing.

nHibernate + Mvc3 Sample Application

I'm looking for a decent codebase that demonstrates how to use nHibernate as the persistance layer in an asp.net mvc3 project.
The two key pieces of understanding that I am looking to develop are
How to deal with ISession and
ISessionFactory.
How to implement the repository pattern without leaking any details of its nHibernate implemenation.
I'm aware of Sharp Architecture and reading through that now - Its interesting but I'm more keen on finding a straight-forward web app to pick apart than another framework to learn.
Thanks in advance.
I put together a project that offers an example of how to do this using nhibernate and asp.net mvc 2. The repository and nhibernate implementations will be almost the same. Probably the biggest change will be the ioc / dependency injection piece. Take a look. It should provide a solid starting point. Here is the URL.
http://gpsnerd.codeplex.com
Let me know if you have questions.
Bob
Take a look at https://bitbucket.org/FunnelWeb/dev
FunnelWeb is a blog engine based on ASP.NET MVC and NHibernate.
It is opensource and used by many bloggers/develoeprs

What is the best practice using NHibernate 3.0 with WCF Web Services?

There seems to be quite a bit of information regarding using NHibernate and WCF Web Services but I'm struggling to find a definitive guide on how to implement the two technologies together in a efficient, thread safe way.
Specifically I want to grab the ISession object and uses that to get and save data through my existing repositories. My Business Objects, Unit Tests and ASP.NET Web Application all use the NHibernate framework and it works just great (it's my first hobby project using an ORM). My big question is how to combine this great framework with WCF Web Services.
I've read that version 3.0 NHibernate has NHibernate.Context.WcfOperationSessionContext but I'm unsure of it's implementation (see this question). From what I understand, one option is to store the ISession object in the OperationContext?
Can anyone point me in the direction of a implementation example?
Many thanks.
Here is a post describing, in detail, all the steps for registering and using the WcfOperationSessionContext. It also includes instructions for using it with the agatha-rrsl project.
WCF and Nhibernate work together in Sharp Architecture project. You can have a look at their implementation

OpenSwing Framework

Is OpenSwing a good framework for developing professional desktop application?
I was recently using the OpenSwing Framework. I can say only the best for the functionalities which are provided with the framework. It is a multitier concept with excelent data binding possibilities. My App uses a small Derby DB in background and I’m managing it with hibernate.
I’m sure, you will be able to advance very fast and provide a working prototype very quick. I would advice you to read the available doc first and to run the provided examples (http://oswing.sourceforge.net/).
However, it has another side which you should be aware of and you will probably notice by yourself if you run the examples. The GridFrame, GridFrameControler, DetailFrame, DetailFrameControler etc classes are not really generic. There are a lot of dependencies bult in and you will have to customize them again and again for every single implementation (can be seen in the demos).
I had another approach, I invested some time in building my own classes which are generic and using the unchanged OpenSwing classes in the background first. Now I’m only setting the properties file where all details are pre-defined. The rest is generic and I don’t have to re-code again and again for every single frame.
I hope this will help.
Regards
I used the openswing in team for more than two years.
It's a pretty nice swing framework for the enterprise development used in the Internal.
It provide great component based by MVP pattern ,such as grid , document ...
If you try it , It's a good article for you about Model-View-Presenter
And try the demo in the source,It's quite good.
The JAllInOne is also a good demo for the framework also made by the mcarniel
and It's a personal project only developed by mcarniel. Thanks mcarniel's great work.

Is this NHibernate sample still valid?

Or the concepts/best practices used there are now deprecated? I'm just starting to use NHibernate and I'm having a hard time finding good real life samples.
http://www.codeproject.com/KB/architecture/NHibernateBestPractices.aspx
As you can see for the dates the author (Billy McCafferty) didn't update it in a long time. There is so much more on the NHibernate ground now but most of the concepts in that article still apply.
You may want to checkout additional sources like:
http://nhforge.org/
http://fabiomaulo.blogspot.com/
http://fluentnhibernate.org/
If you are using NHibernate in web applications, Billy McCafferty built an excelent framework on top of NHibernate and ASP.net MVC. http://www.sharparchitecture.net/
And this open source app is an awesome sample: http://whocanhelpme.codeplex.com/