26 September 2018

ASP.NET Core MVC's Action Result naming changes

Working from version 1.1 to 2.1. I found this very handy:

Following methods on the Controller base class have been renamed for the sake of consistency and making them less verbose.
HttpUnauthorized => Unauthorized
HttpNotFound(and its overloads) => NotFound
HttpBadRequest(and its overloads) => BadRequest
Following action result types have also been renamed. The Http prefix has been removed.
Microsoft.AspNetCore.Mvc.HttpUnauthorizedResult => Microsoft.AspNetCore.Mvc.UnauthorizedResult
Microsoft.AspNetCore.Mvc.HttpOkResult => Microsoft.AspNetCore.Mvc.OkResult
Microsoft.AspNetCore.Mvc.HttpOkObjectResult => Microsoft.AspNetCore.Mvc.OkObjectResult
Microsoft.AspNetCore.Mvc.HttpNotFoundResult => Microsoft.AspNetCore.Mvc.NotFoundResult
Microsoft.AspNetCore.Mvc.HttpNotFoundObjectResult => Microsoft.AspNetCore.Mvc.NotFoundObjectResult
Microsoft.AspNetCore.Mvc.HttpStatusCodeResult = > Microsoft.AspNetCore.Mvc.StatusCodeResult

Source: a user named 'kichalla' from Github

No comments:

Post a Comment