I have the need to do an implementation with along the lines of custom type handling in .NET.
Scenario is, we have a Redis datastore that stores our models serialized in to JSON using Newtonsoft. We anticipate that we will be using the same store from multiple services in the future to fetch data. Due to this, we don't want to use inbuilt type handling since then the other services which uses Newtonsoft to deserialize will break due to them not having objects with the same namespace.
My idea is to manually push a new property like "__type" with the type and "__namespace" with the namespace. Basically I want to not have the "$type" metadata key name and instead have another key to it. I have already implemented a JsonConverter but it's like reinventing the wheel and performance wise, it may not be the best.
Is there a straightforward way of doing this other than implementing the whole serialization and deserialization logic? Can we interpret the lifecycle and do a little manipulation?
Note that this needs to be a generic solution. It should work for all types.