What is Ninject 3 equivalent of this code:
Bind<ISession>().ToMethod(ctx => ctx.Kernel.Get<INHibernateSessionFactoryBuilder>()
.GetSessionFactory()
.OpenSession())
.Using<OnePerRequestBehavior>();
I know that I can use InRequestScope instead of Using<OnePerRequestBehavior> but how to replace ctx.Kernel.Get<INHibernateSessionFactoryBuilder>? (INHibernateSessionFactoryBuilder is a singleton)
Ok, just to clarify - since this is in a Module, you can still access ctx.Kernel.Get<T> but you need to add a using Ninject; to the module too as Kernel.Get<T> is exposed as an extension method.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With