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

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.

主站蜘蛛池模板: 磴口县| 海城市| 衡南县| 小金县| 四川省| 齐齐哈尔市| 岐山县| 富阳市| 丰宁| 肃宁县| 灵台县| 当阳市| 彰化县| 南阳市| 景泰县| 黎平县| 胶州市| 临桂县| 临城县| 神农架林区| 翼城县| 黄山市| 宜阳县| 临清市| 朝阳市| 宣城市| 东阿县| 通河县| 龙川县| 谷城县| 桐城市| 娱乐| 任丘市| 阜阳市| 绥中县| 富蕴县| 荆门市| 瑞金市| 姜堰市| 江永县| 招远市|