Ninject.MVC3 Bootstrapper's Kernel property is marked as Obsolete. How can I get access to the kernel?

后端 未结 4 1842
借酒劲吻你
借酒劲吻你 2021-01-12 01:35

I updated Ninject.MVC3 package from 2.2.1.0 to 2.2.2.0. Before I had access to the Kernel object through BootStrapper.Kernel property but in the new version Kernel property

4条回答
  •  臣服心动
    2021-01-12 01:44

    You could use the Common Service Locator as a service location hook into Ninject. The Common Service Locator only allows you to retrieve objects though, not inject objects that you already have. Of course you could hack around this restriction, but you could just as easily create a static class that exposes the Ninject kernel and reference that rather than the BootStrapper.

提交回复
热议问题