uNhAddIns MultiSessionFactoryProvider + NHExtendedSessionWebModule + Ninject + WebForms

90 views
Skip to first unread message

Leonardo Lima

unread,
Aug 1, 2011, 11:54:34 AM8/1/11
to uNhAddIns
Hi all,


I´m trying to use the MultiSessionFactoryProvider, I already did the
project build correctly, but now I´m getting the following error:

{"No CurrentSessionContext configured (set the property
current_session_context_class)!"}

this error throws here (on class NHExtendedSessionWebModule):

foreach (ISessionFactory factory in sfp)
{
factory.GetCurrentSession().BeginTransaction();
}

I´ve downloaded the project uNhAddIns, and copied the classes that I
wanted use to my project and their dependencies, I just change one
thing that is the way to build a new ISession, because now I´m using
Fluent NHibernate....

Mine Ninject part code
kernel.Bind<ISessionFactoryProvider>().To<MultiSessionFactoryProvider>().InSingletonScope();

kernel.Bind<ISessionFactory>().ToMethod(x =>
x.Kernel.Get<ISessionFactoryProvider>().GetFactory("SessionFactory_Site"))
.InSingletonScope()
.Named("SessionFactorySite");

protected override void OnApplicationStarted()
{
RegisterRoutes(RouteTable.Routes);
Kernel.Get<MultiSessionFactoryProvider>().Initialize();
Application[Commons.SessionFactoryProviderKey] =
Kernel.Get<MultiSessionFactoryProvider>();
}

Fabio Maulo

unread,
Sep 8, 2011, 7:01:24 PM9/8/11
to unha...@googlegroups.com
You have to configure the current_session_context_class 
--
Fabio Maulo

Reply all
Reply to author
Forward
0 new messages