OnDeserialized attribute for ProtoBuf-NET -


We sort our data with OnDeserialized attribute to execute custom code after deserialization JSON.NET is used for:

  [onDeserialized] Internal Zero OnDeserializedMethod (Streaming Contact Reference) {...}  

We now use < Code> protobuf instead of JSON.NET and this method is not executed to achieve this behavior with protobuf.net One more What about

Here is an example that does not work:

  class program {static zero main (string [] args) {RuntimeTypeModel.Default.Add (typef (profile) , False). Add (1000, "id"). Add (1001, "text"); Var Test = New Profile {id = Guind. Newguide (), text = "123"}; (Var memoryStream = new memorystream ()) using {Serializer.Serialize (memoryStream, test); MemoryStream.Sec (0, SeekOrigin.Begin); Var deserialized = Serializer Dairyialize & lt; Profile & gt; (Memorystream); Console.WriteLine (deserialized.Text); // Output "Change" console Readline (); }}} [ProtoContract] Public Square Profile {Public Guide ID {get; Set; } Public string text {get; Set; } [ONESCILIZED] Internal zero on-diaryised mass (streaming contact reference) {text = "changed"; }}  

works fine for me:

 < Code> [Protocco contract] Public class fu {[densiarised) Internal zero ondiserized mass (streaming contact reference) {console.lightlined ("OnDescribedised Meth"); } [Protomber (1)] Public string bar {get; Set; } Fixed zero main () {var foo = new foo {bar = "ABC"}; Var Clone = Serializer Dipclone (af); Console.WriteLine (clone.Bar); }}  

Output:

  OnDeserializedMethod abc  

Can you be more specific? Perhaps reproduces a full example showing what you are looking for? Apart from this: Are you fixed are you using ProtoBuff-Net? Some people are quite confused between protobuf-net and protobuf-csharp-port. I can not comment on that which supports later.


Comments