Class RedbObjectStubWriteConverterFactory
V4 (L.4, LAZY plan §4.3): serializing a RedbObject<T> must never trigger lazy loading.
The default object converter walks the public Props getter — for an unloaded reference stub
that getter IS a load, so serializing a parent would pull the whole lazy graph (the classic ORM
trap). This factory takes over WRITING: base fields are written by hand, and properties is
emitted only when the object is actually loaded (via GetPropsDirectly, which never loads).
Nested references inside the Props re-enter this factory, so a stub anywhere in the graph
serializes as its base fields — the same shape the JSON builders emit at the depth boundary.
READING is a pass-through: the payload is deserialized with the same options minus this factory,
i.e. the exact pre-V4 default path - property mapping, the date/enum/tuple converters, the Props
setter - with one rule on top: an object that arrives without Props (no properties key,
or "properties": null, the shape a foreign serializer gives a loader-less stub) is NOT
loaded, so a parent save leaves it alone as the reference it is.
TreeRedbObject<T> deliberately keeps the default path: this converter would flatten it
to a plain RedbObject<T> on read. Tree relations are not references (LAZY plan §4.12).
public sealed class RedbObjectStubWriteConverterFactory : JsonConverterFactory
Inheritance
Methods
CanConvert(Type)
When overridden in a derived class, determines whether the converter instance can convert the specified object type.
public override bool CanConvert(Type typeToConvert)
CreateConverter(Type, JsonSerializerOptions)
Creates a converter for a specified type.
public override JsonConverter CreateConverter(Type typeToConvert, JsonSerializerOptions options)