I have two Web API controllers to which I want to inject dependencies into using Ninject, like this:
public ProductsController(IProductRepository repository) {
_repository = repository;
}
I'm setting the DependencyResolver
like this:
config.DependencyResolver = new NinjectDependencyResolver(ninjectKernel);
Everything works fine for one controller without a parameterless constructor, but for another controller it's not working without a parameterless constructor.
Can anyone help me out to understand why it's not working?
I have followed this link implement di using ninject from stackoverflow link