C# Class System.Net.Http.Formatting.BetterJsonMediaTypeFormatter

MediaTypeFormatter class to handle Json.
Inheritance: System.Net.Http.Formatting.MediaTypeFormatter
显示文件 Open project: anurse/ReviewR

Public Methods

Method Description
BetterJsonMediaTypeFormatter ( ) : System.Collections

Initializes a new instance of the JsonMediaTypeFormatter class.

CreateDefaultSerializerSettings ( ) : JsonSerializerSettings

Creates a JsonSerializerSettings instance with the default settings used by the JsonMediaTypeFormatter.

Protected Methods

Method Description
CanReadType ( Type type ) : bool

Determines whether this JsonMediaTypeFormatter can read objects of the specified type.

CanWriteType ( Type type ) : bool

Determines whether this JsonMediaTypeFormatter can write objects of the specified type.

OnReadFromStreamAsync ( Type type, Stream stream, HttpContentHeaders contentHeaders, FormatterContext formatterContext ) : Task

Called during deserialization to read an object of the specified type from the specified stream.

OnWriteToStreamAsync ( Type type, object value, Stream stream, HttpContentHeaders contentHeaders, FormatterContext formatterContext, TransportContext transportContext ) : System.Threading.Tasks.Task

Called during serialization to write an object of the specified type to the specified stream.

Private Methods

Method Description
IsKnownUnserializableType ( Type type ) : bool

Method Details

BetterJsonMediaTypeFormatter() public method

Initializes a new instance of the JsonMediaTypeFormatter class.
public BetterJsonMediaTypeFormatter ( ) : System.Collections
return System.Collections

CanReadType() protected method

Determines whether this JsonMediaTypeFormatter can read objects of the specified type.
protected CanReadType ( Type type ) : bool
type Type The type of object that will be read.
return bool

CanWriteType() protected method

Determines whether this JsonMediaTypeFormatter can write objects of the specified type.
protected CanWriteType ( Type type ) : bool
type Type The type of object that will be written.
return bool

CreateDefaultSerializerSettings() public method

Creates a JsonSerializerSettings instance with the default settings used by the JsonMediaTypeFormatter.
public CreateDefaultSerializerSettings ( ) : JsonSerializerSettings
return Newtonsoft.Json.JsonSerializerSettings

OnReadFromStreamAsync() protected method

Called during deserialization to read an object of the specified type from the specified stream.
protected OnReadFromStreamAsync ( Type type, Stream stream, HttpContentHeaders contentHeaders, FormatterContext formatterContext ) : Task
type Type The type of object to read.
stream System.IO.Stream The from which to read.
contentHeaders System.Net.Http.Headers.HttpContentHeaders The for the content being written.
formatterContext FormatterContext
return Task

OnWriteToStreamAsync() protected method

Called during serialization to write an object of the specified type to the specified stream.
protected OnWriteToStreamAsync ( Type type, object value, Stream stream, HttpContentHeaders contentHeaders, FormatterContext formatterContext, TransportContext transportContext ) : System.Threading.Tasks.Task
type Type The type of object to write.
value object The object to write.
stream System.IO.Stream The to which to write.
contentHeaders System.Net.Http.Headers.HttpContentHeaders The for the content being written.
formatterContext FormatterContext
transportContext TransportContext The .
return System.Threading.Tasks.Task