CMertens / protobuf-net

Automatically exported from code.google.com/p/protobuf-net
Other
0 stars 0 forks source link

Serializing System.Object #246

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
When serializing a type which includes a property of the type system.object, we 
get the exception: "No serializer defined for type: System.Object"

In NET DataContractSerializer it is supported. Is there a way to also support 
it in protobuf-net?

Original issue reported on code.google.com by m.schw...@ondot.at on 4 Nov 2011 at 5:53

GoogleCodeExporter commented 9 years ago
The nature of the protobuf spec makes it aimed at data that is well-known in 
advance, so the google spec does not cover this. As an extension, protobuf-net 
is exploring ways to do this. If you set DynamicType = true on your propery (in 
the ProtoMember attribute) it will attempt to do this. However this currently 
had limitations, in partiular this option currently struggles with primitives 
and inheritance models. It will handle basic DTOs though. Note this also 
involves embedding type names in the stream; this can be a problem for 
versioning, so an event is provided to help you handle type-name <===> type 
conversions in a controlled way.

Original comment by marc.gravell on 4 Nov 2011 at 6:40