Open GoogleCodeExporter opened 9 years ago
In our current project we are looking for the same feature as well. I made a
few
minor changes (in csharp.xslt and the Property classes in protobuf-net) to make
it
check required fields (well, properties only) on serialisation. We also use
the "WithLengthPrefix" version for serialisation which provides some degree of
checking on deserialisation.
We only use a limited set of features in protobuf-net so while the change is
sufficient for us, it probably would not work in other scenarios (e.g. we only
use .proto files to generate C# classes rather than defining them directly).
Not
sure if Marc would be interested in a patch?
Original comment by ken.c....@gmail.com
on 2 Oct 2009 at 8:31
This is something I'd like to have available, but for various reasons I've had
very
little time to look at it lately. I'd welcome a patch, of course. I'd need to
see how
the patch impacts existing code etc, too.
Original comment by marc.gravell
on 2 Oct 2009 at 8:44
Attached is the workaround I'm using. Basically it's just adding an extra
private
field to keep track of whether a required field has been set.
Original comment by ken.c....@gmail.com
on 6 Oct 2009 at 12:55
Attachments:
Are there any plans to incorporate this functionality into the library? If not,
is there any way to check if all required fields were deserialized (= found in
the incoming protobuf binary representation)?
Original comment by boris.me...@gmail.com
on 30 Apr 2014 at 12:32
Original issue reported on code.google.com by
s.volchkov
on 26 Aug 2009 at 4:00