Is ApiController deprecated in .NET Core

后端 未结 4 667
-上瘾入骨i
-上瘾入骨i 2021-01-31 01:04

Is it true that \"ApiController will get deprecated in .NET Core\"? Asking since I\'m planning to use it in new projects.

4条回答
  •  不知归路
    2021-01-31 02:08

    As others mentioned, ASP.NET Core is a complete new webstack that's not compatible with the old ASP.NET MVC webstack. This is explicitly reflected in it's name and versioning!

    ASP.NET Core and ASP.NET Core MVC have the version 1.0.0 to make this incompatibility very clear.

    ASP.NET Core merged the MVC and WebApi into one single Api just called.

    And here's the thing you may have been looking for:

    If you are migrating from a previous ASP.NET MVC or ASP.NET WebApi application, you may want to import the Microsoft.AspNetCore.Mvc.WebApiCompatShim package which provides some compatibility types which makes migrations easier from the previous versions. Among them is the ApiController class and certain attributes that were removed in the new webstack Api.

    However, please note that this is only there to help you with migrating existing applications. When you create a new application you shouldn't use this compatibility shim and just use the new stuff.

提交回复
热议问题