1

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

Community
  • 1
  • 1
user3603255
  • 260
  • 1
  • 3
  • 12
  • Are you injecting same IProductRepository to another controller or different one? Also make sure that they inherit same base class. – Win Jul 01 '14 at 20:34

0 Answers0