asp.net-mvcnhibernatefluent-nhibernateninjectwebactivator

Nhibernate (Fluent), Ninject.Mvc3, and Web Activator


I am working on an ASP .NET Mvc 3 App and have installed Ninject.Mvc3 using Nuget. I now have the App_Start folder and then ninject class. I have seen plenty of examples on how to configure NHibernate in the Global.asax file. So how do I configure the session before handing it Ninject if I am using the Web Activator class? Do I just do it like normal in the global.asax?,


Solution

  • Bob Cravens has a nice series of posts on how to do this:

    Using the Repository Pattern with MVC and NHibernate

    http://blog.bobcravens.com/2010/06/the-repository-pattern-with-linq-to-fluent-nhibernate-and-mysql/

    Using an IoC container (like Ninject) with a NHibernate inside ASP.NET MVC

    http://blog.bobcravens.com/2010/07/using-nhibernate-in-asp-net-mvc/

    Any responsible web developer knows that managing / disposing of objects and resources is critical to good web application development. Please make sure and read this bit too :-)

    http://blog.bobcravens.com/2010/11/using-ninject-to-manage-critical-resources/