serialization

On Protobuf.Net, using AsReference and multiple instances of object which should be deserialized only once.

  • Posted on: 27 November 2014
  • By: Michał Turecki

There is a ProtoBuf.Net fact regarding using AsReference which somehow I missed when digging into why [ProtoAfterDeserialization] attribute is not applied for some objects.
The truth is that it is applied for some but not other objects even if I used AsReference attribute in some places. The AsReference attribute should be applied to ALL REFERENCES TO THE OBJECT, both collections and navigational properties, NOT JUST REFERENCES OTHER THAN THE REFERENCE WE CONSIDER MAIN ONE.