I'm translating some code from the DataContractSerializer to the impressive protobuf-net serializer, and one thing that I'm really missing is the StreamingContext passed through to my OnDeseriali开发者_如何学JAVAzing methods. I'd really like to find a way to pass a bit of context information through to some of my objects during their deserialization.
My question: is this usage pattern supported in protobuf-net? I haven't found an equivalent so far in my investigation of its APIs, but I'm not very familiar with its design so may have overlooked something.
The signature with a StreamingContext
is supported, but it does not currently include the .Context
(it currently just announces StreamingContextStates.Persistence
with .Context = null
), if that is what you mean.I could support that by adding an overload to the serialize/deserialize methods - presumably that would solve it?
If so, please log a feature request on the project site. Since it already supports StreamingContext
in this scenario, it doesn't sound hard.
精彩评论