Skip to main content
Version: Preview (0.3.0-preview.205)

Class JsonSerializerOptionsExtensions

Namespace: AdCodicem.ValueObjects.Json
Assembly: AdCodicem.ValueObjects.Json.dll

Wires value object support into .

public static class JsonSerializerOptionsExtensions

Inheritance​

object ← JsonSerializerOptionsExtensions

Inherited Members​

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

Methods​

AddValueObjects(JsonSerializerOptions)​

Adds the value object converter factory to the options.

public static JsonSerializerOptions AddValueObjects(this JsonSerializerOptions options)

Parameters​

options JsonSerializerOptions

Options to configure.

Returns​

JsonSerializerOptions

The same options, so calls can be chained.

Remarks​

Reflection-based serialization already honours the converter each generated value object carries, so this is only needed for value objects written by hand, or to make the behaviour explicit at the composition root. Adding it twice is harmless but wasteful, so an existing registration is left alone.