Dependency Injection in ASP.NET Web API (Ninject)
I need to implement DI in my Web API Project. I’m using a Ninject and got a little problem.
I need to implement DI in my Web API Project. I’m using a Ninject and got a little problem.
I went through the recommended steps to add Ninject to my MVC application. And I added a DbContext argument to my controllers’ constructors.
I have an ASP.NET MVC web application that implements a custom membership provider. The custom membership provider takes a UserRepository to its constructor that provides an interface between the membership provider and NHibernate. The UserRepository is provided by the Ninject IoC container.
I am trying to install Ninject 3.3.2 in .NET Core, Released in May 2016. I got an error: The dependency Ninject 3.2.2 does not support framework .NETCoreApp, Version=v1.0.
Does anybody had similar problem, and is there any solution for this?
i have setup my project with Ninject IoC.
My project has regular Asp.Net MVC controllers and Web Api controllers. Now, Ninject works with Web Api but Ninject doesn’t work with regular Asp.MVC controllers.
My regular MVC controller implementation;
Note: Now that I’ve typed this out, I have to apologize for the super long question, however, I think all the code and information presented here is in some way relevant.
Having deployed my website to IIS7.5 I found one strange behaviour: when application pool identity is left to be ApplicationPoolIdentity by default (as recommended in IIS Application Pool Identities), Ninject seems to be ignored, as I get the following error, while creating the very first controller:
I have used the NuGet Ninject MVC3 extension and have been unable to get it to inject into a controller upon request. It doesn’t seem to have bound, as MVC is looking for the paramaterless constructor. Here’s the stack trace:
I use ninject framework. In my code I have a Lazy object. I can create an instance, but when I call the value property I got an exception.
With NInject (preferably 2.0), what options do we have wrt wiring up our object dependencies in a web application?