This project is read-only.

Nhibernate Session Factory Registration

Topics: General
Aug 12, 2011 at 2:19 PM


I'm currently looking at the Orchard source code and can't find where to register the Nhibernate session factory. It looks the class SessionFactoryHolder is response for create th Nhibernate session factory, but I can't find where to register it. Can anybody give me some hint of it?

Thank you

Aug 12, 2011 at 3:40 PM

What do you mean by "register" ? You don't need to register anything, you can use it directly though.

Aug 12, 2011 at 5:24 PM

You can get at the sessions you need from Orchard's ISessionLocation.  That can be injected or resolved as you need it and then you can get a session for the type that you wish to work with by calling sessionLocator.For(typeof(MyContentPartRecord))


Aug 13, 2011 at 2:44 AM

Sorry, I should make my question more clear. What I'm trying to know is how the NHibernate Session factory been initialized. I have known that it is been instanced by the AutoFac, but I can't find where it is been registered into the Autofac. Hope I make the question more clear.