I use AutoMapper to convert the user interface model to POCOs, which I later serialize to XML using the DataContractSerializer to keep the links between them.
The problem is that when matching links between these objects are lost .
The user interface classes reference each other, but the mapping process creates new instances for each link, so the original relationships are broken: (
Let me explain:
I have 2 objects of type Person
Person { List<House> OwnedHouses }
And these 2 objects
John who owns
Will who also owns
When AutoMapper correctly displays each person, but when it also displays House1 as two different instances!
So, I have two copies of House1. John owns his House1 (No. 1), and Will owns his House1 (No. 2).
They are no longer connected.
Is there a way to keep the relationship that originally existed?
Thanks.
EDITED: Actually, I have the following:
The document contains a list of ChildDocuments. Each ChildDocument has a list of Designables (Rectangles, Lines, Ellipses ...) and a special design called the ChildDocumentAdapter, which contains the OTHER ChildDocument itself. This is a problem; it may refer to another ChildDocument.

source share