So, if I have:
[ProtoContract]
public abstract class BaseRequest
{
[ProtoMember(1)] public Guid Guid { get; set; }
}
[ProtoContract]
public class Request : BaseRequest
{
[ProtoMember(1)] public long Id { get; set; }
}
and I try to serialize Request and deserialize BaseRequest, it won't work. It doesn't know what is the concrete class. I would need to add a [ProtoInclude]. That makes sense to me.
What I'm seeing is that if I serialize Request and deserialize Request, that also doesn't work, which I think is unexpected. I would expect the serializer to already know everything it needs in order to work in that case. I need to include the [ProtoInclude] on BaseRequest even if all I'm serializing is Request.
Where I run into trouble is that I have a BaseRequest defined in a library and consumers of that library need to inherit from it. Basically, a particular kind of request has to have data attached to it-- is there a pattern for this, outside of dumping the inheritance and copy/pasting that code into every child class?