I am trying to serialize a complex object through DataContract . The object has a list of sub-objects, which in turn have their own list (let's call it - tree leaves). These leaves, for example, the first item in the list of the main object, can be reached from other list items (the link is the same). It turns out quite a complicated graph, in which there are many links.
When deserializing, each element of the list has its own leaves, i.e. links are lost, if in the source object it is the same sheet, then after deserialization it is just a copy.
Like that
AA / \ / \ BC ====> BC \ / | | DDD[копия] (this is a very simplified diagram)
I tried for all classes to register DataContract(IsReference = true) , so, just in case, it did not help.
Is there a more “quick” way to correctly deserialize, except as a “manual” alignment of the structure of the repeating source object?
Thank.
DataContractSerializerset the settings for itsnew DataContractSerializerSettings { PreserveObjectReferences = true }. - Alexander PetrovNetDataContractSerializer. - Alexander Petrov