Open GoogleCodeExporter opened 9 years ago
There are lots of options here:
- constructors are *optional*, and can be completely disabled with the
SkipConstructor instruction on ProtoContract, or via the RuntimeTypeModel
- there is full support for deserialization callbacks, both before and after
deserialization - using the standard attributes or protobuf-net specific
attributes
- you can also supply your own type-factory on a per-type basis
Any of those help?
Original comment by marc.gravell
on 18 Jan 2013 at 4:02
- Indeed, constructor optionality is quite handy. Except, disabling the
constructor also disables field initalization, it seems.
- The callback method attributes are useful as well, only, they are also
parameterless, as far as I know.
- Factories could be a viable option, but I didn't find any information on how
to pass them context information.
Original comment by symboli...@gmail.com
on 18 Jan 2013 at 4:25
callbacks and factory methods both optionally take the serialization context as
parameters; either the regular framework ones, or the specific pb-net context.
IIRC, TypeModel.Deserialize accepts the context, but if not: ProtoReader
definitely does. I'm not at a PC, but I can prepare and example later. Any
preference between the two?
Original comment by marc.gravell
on 18 Jan 2013 at 4:37
Thank you, this should do the trick. TypeModel.Deserialize does, indeed, have a
SerializationContext parameter.
The example won't be necessary, at least for me.
Original comment by symboli...@gmail.com
on 18 Jan 2013 at 4:47
Original issue reported on code.google.com by
symboli...@gmail.com
on 18 Jan 2013 at 3:22