0

I'm decided to migrate from .Net classic web api project to .Net core project. Many developers say to me for migration you don't have any concern about code changes, because .net core support package for Ninject, but I don't see any operational example. Please tell me exactly could I use my old api controller from .net classic project in .net core project using Ninject?

Jan Muncinsky
  • 4,282
  • 4
  • 22
  • 40
  • 1
    Possible duplicate of [Ninject in .NET Core](https://stackoverflow.com/questions/38261521/ninject-in-net-core) – rekiem87 Apr 30 '19 at 19:19
  • Possible duplicate of [How to integrate Ninject into ASP.NET Core 2.0 Web applications?](https://stackoverflow.com/questions/46693305/how-to-integrate-ninject-into-asp-net-core-2-0-web-applications) – Edward May 01 '19 at 02:13

1 Answers1

0

ASP.NET core comes with completly new web framework. Regarding your existing controllers from classic web api framework, you can do the following:

  • rewrite them to fit the new framework
  • or use Microsoft.AspNetCore.Mvc.WebApiCompatShim, so you can reuse them

Here is the article describing this topic:

https://learn.microsoft.com/en-us/aspnet/core/migration/webapi?view=aspnetcore-2.2

What you don't have to rewrite are dependencies that can be ported to .nestandard. This is also the case of Ninject, because it already supports .nestandard, so if you've already written any Ninject modules you can use them. But the integration with the ASP.NET core looks different, beacause the framework is different. As already commented this link shows the integration:

How to integrate Ninject into ASP.NET Core 2.0 Web applications?

Jan Muncinsky
  • 4,282
  • 4
  • 22
  • 40