Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ninject Kernel Scope

I'm new to Ninject, and I was wondering if the scope of the kernel should be 1 per application. So should I treat the kernel as a singleton?

Thanks.

like image 737
Aaron Drenberg Avatar asked Apr 27 '10 02:04

Aaron Drenberg


People also ask

What is ninject kernel?

In Ninject the Kernel is the component that controls everything. We can directly bind the interfaces with implementations in the Kernel or we can pass them wrapped as modules. Whenever we need any implementation of the mapped interface we can get it right away from the Kernel.

What is a ninject module?

Ninject modules are a good way to segregate our type bindings into distinct groups of bindings, which can be easily organized into separate files. Minimum requirement for a class to be accepted as a Ninject module is to implement the INinjectModule interface.

Is ninject open source?

License. Ninject is intended to be used in both open-source and commercial environments.

What is InRequestScope?

InRequestScope method - it tells Ninject that one object of a particular type should be created for each individual request. InSingletonScope method - it tells Ninject that one object of a particular type should be created for all requests.


1 Answers

Yes, you should. More precisely - You should have one root container. It's OK to create context specific subcontainers.

like image 101
Krzysztof Kozmic Avatar answered Sep 27 '22 16:09

Krzysztof Kozmic