Open GoogleCodeExporter opened 9 years ago
If you really want to know that it is protobuf-net, use the specific
protobuf-net attribute - JSON won't call that.
In v2, there is additional support for passing in a serialization context which
could be detected, but in *general*, it will be hard to tell between
serializers. Is there a specific scenario you need this for?
Original comment by marc.gravell
on 26 Sep 2011 at 7:46
Yes, I'm using a custom serialization process making use of a PostSharp aspect,
the serialization 'event handlers' and 'Extensible' to manually append/get
fields by 'id'
Usage is something like:
[ProtoTypeMember(1, Scalar = typeof(long), Converter =
typeof(DateTimeConverter))]
public DateTime UploadedOn { get; set; }
Thing is that the code that uses the 'Extensible' class should only be used by
the protobuf serializer.
But I found an ugly work around:
if (Environment.StackTrace.Contains(".DataContractJsonSerializer.")) { /* json
serializer in action */ }
Works, but ugly so a better alternative would be welcome.
Original comment by tim@mylemans.com
on 27 Sep 2011 at 10:41
Original issue reported on code.google.com by
tim@mylemans.com
on 26 Sep 2011 at 6:21