Ninject how to access the kernel for instantiation?

I am new to ninject using ninject 2.0. My application is hosted in asp.net mvc.

Now I do not know how to access the kernel created in my class library.

I think I should create a kernel in global.aspx and load all modules into it. But how can I make it available throughout the application?

    protected void Application_Start()
    {
        RegisterRoutes(RouteTable.Routes);

        IKernel kernel = new StandardKernel(new ServiceModule());
    }

Where should the kernel above be created? and how to access it?

+3
source share
1 answer

See the Ninject Dojo extension section for Ninject.Web.Mvc. This will show you the default template for managing such things (look at the source).

( ) .

CSL. Ninject , , (, , public Kernel public Global - public ( WCF, , )

+2

Source: https://habr.com/ru/post/1754039/


All Articles