SystemTextJsonInputFormatter 类

定义

使用 TextInputFormatterJsonSerializer的 JSON 内容的 。

public ref class SystemTextJsonInputFormatter : Microsoft::AspNetCore::Mvc::Formatters::TextInputFormatter, Microsoft::AspNetCore::Mvc::Formatters::IInputFormatterExceptionPolicy
public class SystemTextJsonInputFormatter : Microsoft.AspNetCore.Mvc.Formatters.TextInputFormatter, Microsoft.AspNetCore.Mvc.Formatters.IInputFormatterExceptionPolicy
type SystemTextJsonInputFormatter = class
    inherit TextInputFormatter
    interface IInputFormatterExceptionPolicy
Public Class SystemTextJsonInputFormatter
Inherits TextInputFormatter
Implements IInputFormatterExceptionPolicy
继承
SystemTextJsonInputFormatter
实现

构造函数

SystemTextJsonInputFormatter(JsonOptions, ILogger<SystemTextJsonInputFormatter>)

初始化 SystemTextJsonInputFormatter 的新实例。

属性

SerializerOptions

获取 JsonSerializerOptions 用于配置 的 JsonSerializer

SupportedEncodings

获取此 TextInputFormatter支持的字符编码的可变集合。 读取数据时使用编码。

(继承自 TextInputFormatter)
SupportedMediaTypes

获取此 InputFormatter支持的媒体类型元素的可变集合。

(继承自 InputFormatter)

方法

CanRead(InputFormatterContext)

确定这IInputFormatter是否可以反序列化 的 ModelType对象context

(继承自 InputFormatter)
CanReadType(Type)

确定这 InputFormatter 是否可以反序列化给定 type的 对象。

(继承自 InputFormatter)
GetDefaultValueForType(Type)

获取给定类型的默认值。 用于在正文不包含任何内容时返回默认值。

(继承自 InputFormatter)
GetSupportedContentTypes(String, Type)

获取 和 contentType支持的内容类型IInputFormatterobjectType的筛选列表。

(继承自 InputFormatter)
ReadAsync(InputFormatterContext)

从请求正文中读取 对象。

(继承自 InputFormatter)
ReadRequestBodyAsync(InputFormatterContext)

从请求正文中读取 对象。

(继承自 TextInputFormatter)
ReadRequestBodyAsync(InputFormatterContext, Encoding)

从请求正文中读取 对象。

SelectCharacterEncoding(InputFormatterContext)

基于 context的字符集返回 Encoding

(继承自 TextInputFormatter)

显式接口实现

IInputFormatterExceptionPolicy.ExceptionPolicy

获取标志,以指示正文模型联编程序是否应处理所有异常。 如果处理了异常,主体模型联编程序会将异常转换为模型状态错误,否则允许该异常传播。

适用于