Table of Contents

Class JsonValueReaderWriter<TValue>

Namespace
Microsoft.EntityFrameworkCore.Storage.Json
Assembly
Microsoft.EntityFrameworkCore.dll

Reads and writes the JSON value for a given model or provider value.

public abstract class JsonValueReaderWriter<TValue> : JsonValueReaderWriter

Type Parameters

TValue
Inheritance
JsonValueReaderWriter<TValue>
Derived
Inherited Members

Constructors

JsonValueReaderWriter()

protected JsonValueReaderWriter()

Properties

ValueType

public override sealed Type ValueType { get; }

Property Value

Type

Methods

FromJson(ref Utf8JsonReaderManager, object?)

public override sealed object FromJson(ref Utf8JsonReaderManager manager, object? existingObject = null)

Parameters

manager Utf8JsonReaderManager
existingObject object

Returns

object

FromJsonTyped(ref Utf8JsonReaderManager, object?)

Reads the value from JSON.

public abstract TValue FromJsonTyped(ref Utf8JsonReaderManager manager, object? existingObject = null)

Parameters

manager Utf8JsonReaderManager

The Utf8JsonReaderManager for the JSON being read.

existingObject object

Can be used to update an existing object, rather than create a new one.

Returns

TValue

The read value.

Remarks

The CurrentReader is at the node that contains the value to be read. The value should be read as appropriate from the JSON, and then further converted as necessary.

Nulls are handled externally to this reader. That is, this method will never be called if the JSON value is "null".

In most cases, the value is represented in the JSON document as a simple property value--e.g. a number, boolean, or string. However, it could be an array or sub-document. In this case, the Utf8JsonReaderManager should be used to parse the JSON as appropriate.

ToJson(Utf8JsonWriter, object)

public override sealed void ToJson(Utf8JsonWriter writer, object value)

Parameters

writer Utf8JsonWriter
value object

ToJsonTyped(Utf8JsonWriter, TValue)

Writes the value to JSON.

public abstract void ToJsonTyped(Utf8JsonWriter writer, TValue value)

Parameters

writer Utf8JsonWriter

The Utf8JsonWriter into which the value should be written.

value TValue

The value to write.