Search code examples
c#asp.net-mvc-3ninject-2

Ninject ninjectKernel.Get<ISession>();


Where can i find ninjectKernel? I am using ninject 2.2

public ISession Session
{
    get { return ninjectKernel.Get<ISession>(); }
}

Edit: I created a service locator to get my kernel from anywhere.


Solution

  • You provided a code for a property (Session) of some class. This code features a get accessors that uses ninjectKernel field. Most likely you can find this field in the enclosing class.

    Usually it's defined like this:

    IKernel ninjectKernel = new StandardKernel(new Module1(), new Module2(), ...);
    

    Where Module1, Module2, etc are the modules that define your bindings.