As part of moving from WCF to gRPC I am dealing with NetDataContractSerializer which is used for serializing objects on client side and de-serializing on server side. Both client and server are sharing same DLL with types used in communication.
As part of client app update process actual version of shared DLL with new/changed/deleted definitions of communication objects is downloaded from server. The basic communications objects used for update process are never changed. So serialization/deserialization during update works.
I would like to rewrite existing code as little as possible. I found out that I could replace NetDataContractSerializer
by Newtonsoft's Json.NET serialization as described here:
How to deserialize JSON to objects of the correct type, without having to define the type before hand? and here https://www.newtonsoft.com/json/help/html/SerializeTypeNameHandling.htm.
But I wonder if:
- Is there better solution in general?
- Is there some solution based on what is part of .NET framework 4.8 and will be also working in .NET 5.0 without need to reference third-party DLL?
- Is there some binary-serialization alternative which would be more message-size friendly / faster? It is not mandatory for me to have sent messages in readable form.