What are all these ninject packages in nuget for integrating with the WEB API?

I am creating an application using Ninject (MVC5 + WEBAPI). And having some problems figuring out which of the many answers explain the most advanced solution for integrating Ninject and WebApi. Therefore, I have the following packages installed:

  • Ninject
  • Ninject Integration for WebApi2
  • Ninject.MVC5
  • Ninject.Web.Common
  • Ninject.Web.Common.WebHost

Some people suggest that my initial problem (Ninject does not allow instantiation of APIs) should be solved either:

  • Installing another package (Ninject.Web.WebApi-RC, Ninject.WebAPI, etc.)
  • Create your own dependency converter
  • Installing the Ninject Owin Node
  • Mix all of the above and hope that it finally works.

So, all what are packages? Also, do I need to use Owin hosting? I received the message “Could not find the Ninject.Web.WebApi package” from the nuget console, so I assume that this no longer exists?

Thanks.

+8
asp.net-web-api asp.net-mvc-5 ninject asp.net-web-api2
source share
1 answer

There are several packages required to run Ninject with Web API 2:

  • Ninject (base library)
  • Ninject.Web.Common
  • Ninject.Web.Common.WebHost
  • Ninject.Web.WebApi.WebHost ("Ninject Web Host for WebApi 2")
  • Ninject.Web.WebApi ("Ninject Integration for WebApi 2")

After you install all of them, you will find the finished class NinjectWebCommon in your App_Start folder. Just add the bindings to the RegisterServices () method.

+9
source share

All Articles