Is there any way for ServiceStack’s TypeSerializer to handle boxed objects with a bit more success? I’m imagining an extension/setting for it to encode types as necessary. For example if I were to serialize and deserialize:
Object x = Guid.NewGuid()
Object y = serializer.DeserializeFromString(serializer.SerializeToString(x))
I would end up with a boxed string in my new Object y, rather than a boxed Guid. It would be nice if it would know enough to give me a boxed Guid. Is it this possible? Has such a feature been considered for TypeSerializer?
There is no type information emitted on the wire for value types. You either need to specify the type information on the call site, e.g:
Or the type information is on the type you’re deserializing into, e.g:
Or you can use the dynamic API, e.g: