I'm trying to get my head around protobuf-net at the moment, and found this article on being able to serialize sub-types: How to Serialize Inherited Class with ProtoBuf-Net
Effectively this suggests that the base type needs to know about the sub-type:
[ProtoContract]
[ProtoInclude(1, typeof(SubType))]
class BaseType { ... }
class SubType : BaseType { ... }
Questions:
- What if the sub-type is unknown?
- Can protobuf-net be automatically configured for a particular type and its sub-types (without knowing them)?
- Thirdly, is there something like a Fluent-API for configuring protobuf-net, instead of using attributes?