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

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.

主站蜘蛛池模板: 扬州市| 成安县| 南丹县| 宁津县| 鹰潭市| 颍上县| 闻喜县| 兴业县| 岳西县| 于都县| 板桥市| 潼南县| 宿迁市| 大方县| 松阳县| 北辰区| 若尔盖县| 兖州市| 道真| 安乡县| 河东区| 永泰县| 石屏县| 高平市| 上蔡县| 栾城县| 建阳市| 沅陵县| 庄河市| 安仁县| 喜德县| 乌兰察布市| 陇川县| 连山| 临海市| 高密市| 岑溪市| 桃园县| 白水县| 左贡县| 汕头市|