0

I'm working on a MVC5 application and i'm trying to implement DI on my controller class. I have correctly put binding on Ninjectwebcommons. Still constructor of the controller class is receiving just null implementations.

 public class AdServiceController : Controller
{
    private IClientRequestPackage _clientReqPkg;
    private ISearchAd                 _searchAd;
    private ICreateConnection _createConnection;
    private INewConnectionResult _newConnectionResult;
    private IBuildDataObjects _buildDataObjects;
    private IAdSearchResultObj _adSearchResultObj;



    public AdServiceController (ICreateConnection createConnection)

    {
        _createConnection = createConnection;

    }

This createConnection implementation has a dependency on Iconfigparams. I'm seeing Iconfigparams is just null.

Any help pl.

Chanu

  • in unit test where I bind using kernel.Bind and gets implementations using kernel.get things works correctly. – Chanuka Perera Jul 02 '16 at 03:26
  • I kind of figured out whats going on. I read config parameters from app.config. If i define values directly in the class it works. What i dont get it is in the unit test i can see values correctly passed being read from app.config. – Chanuka Perera Jul 02 '16 at 04:15
  • Can you paste your DI code. – Mariusz Jul 02 '16 at 11:15

0 Answers0