官术网_书友最值得收藏!

Explicit return type

The simplest form of an action method is the one where the return type is a predefined .NET type, such as primitives or classes you have created. When the method returns a value, the ASP.NET Core pipeline create a success response (with the status code 200 OK) and serializes the value with a formatter that is suitable to the content type that the client requested (via the Accept header in the HTTP request) or with the configured default formatter (the JSON formatter, unless configured otherwise). 

Although returning an explicit predefined type is the simplest way to create actions, it's also the most restricted way. My recommendation is not to use this method, and instead, configure all of your actions to return ActionResult<T> or IActionResult.

主站蜘蛛池模板: 开封市| 白玉县| 盐池县| 柯坪县| 历史| 五指山市| 昆明市| 上思县| 云和县| 奉化市| 永泰县| 通辽市| 巧家县| 天门市| 伊宁市| 咸丰县| 天峨县| 浦城县| 白河县| 盐津县| 崇礼县| 来安县| 新泰市| 东乌| 泰宁县| 岑巩县| 方正县| 丘北县| 焉耆| 禹州市| 曲靖市| 自贡市| 庄浪县| 曲阜市| 寻乌县| 驻马店市| 昌都县| 波密县| 泾阳县| 钦州市| 逊克县|