I have a multitier application using NInject to resolve dependency injection. Each tier has a particular NInject module:
Service Layer - ServiceModule DataLayer - DataModule
In my presentation layer I really dont want to load every single module. Instead of that I want, for an example, load the ServiceModule and the module is responsible to load its dependencies.
How can I achieve that?
For example here is my ServiceModule:
public class ServicesModule : NinjectModule
{
public override void Load()
{
...
Bind<IProductService>().To<ProductService>();
...
}
}
using Ninject;
you will also get an extension method that provides aKernel.Load
method that makes it even easier...Kernel.Load(params INinjectModule[] modules);
. – Vogue