You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently im using json serializer (Json.net more specifically) but im investigating adding binary serializer as well for efficiency and when readability is not required.
I saw that you support external references which i consider to be very useful in my project but this feature require implementing interface on serialized object which is off-table.
So my question is are there alternatives to this interface that allow same or similar effect without requiring modifying serialized object?
If not i would like to request something akin to ReferenceResolver in Json.net. (basically abstract class that intercepts reference indentifiers when deserializing and produces them when serializing)
The text was updated successfully, but these errors were encountered:
Currently implementing the interface is the only way.
But implementing an alternative as you described should be pretty easy:
Add a bool "SerializeAsExternalReference" to TypeConfig so we can use that instead of having to check for an interface (would also be a free performance improvement!).
Add an IReferenceResolver interface that gets stored in the SerializerConfig.
In ReferenceFormatter check if the TypeConfig (which we have to retreive anyway) has that newly added "external flag" set, and if so, then just call the reference resolver.
All of that could be implemented such that it would still be compatible with the old code.
Even better: Right now the external "ID" of an object is locked to being an int, but it doesn't have to be that way. In fact, we could make it so the reference resolver has full control over whats written.
That way the user has the option to save space (by writing a VarInt), or go the "easy way" (by writing a normal fixed 32bit int, just like is being done right now), or use some entirely different identifier (like a string or something)...
Currently im using json serializer (Json.net more specifically) but im investigating adding binary serializer as well for efficiency and when readability is not required.
I saw that you support external references which i consider to be very useful in my project but this feature require implementing interface on serialized object which is off-table.
So my question is are there alternatives to this interface that allow same or similar effect without requiring modifying serialized object?
If not i would like to request something akin to
ReferenceResolver
in Json.net. (basically abstract class that intercepts reference indentifiers when deserializing and produces them when serializing)The text was updated successfully, but these errors were encountered: