References of nodes in GoDiagram(XML of diagram)

My GoDiagram Application has 2 GoViews. And the nodes in 1st goView have reference of other node in 2nd GoView. This application contains some code which is performed when some node is changed in 1st goView then the node(its reference is stored in a node in 1st goView) in the 2nd GoView is modified.
Now , this works fine when I am creating everything at first time. But when I save this as XML using GoXML writer and open it using GoXML reader, it opens only diagram. But I can not save references of nodes as this is heap memory location which will be different when I reads next time. So when I read again the diagram(both diagrams 1st and 2nd goView), I want to make changes in the diagrams which should be reflected in other diagram(as code uses references of nodes). But currently, I can not do these changes in diagram, opened reading existing XML of the diagram.
I want to know best practice to solve above issue with minimum time to open saved diagrams. I know that i need to somehow get back the new references and keep in each node. But I am finding it difficult to do it.
Could you please help me to solve the problem?

Thanks you very much…

you can set GoDocument.MaintainsPartID to true.

Then use PartID as your “referernce” and save it in the XML.

From the User Guide:

To simplify the generation of unique IDs for nodes and ports and links, GoDocument has a property that automatically makes sure that each node, port, or link that is added to the document has a unique PartID. Just set the GoDocument.MaintainsPartID to true. All objects that implement the IGoIdentifiablePart interface provide a PartID property; this is set by GoDocument as objects are added to the document.

When you need to refer to objects, such as to the ports of a link that you are storing, you can just pass the PartID. Upon loading, you can find the IGoIdentifiablePart in the document with that ID by calling GoDocument.FindPart. Remember to save the LastPartID in your document too, to avoid any possible duplicate PartIDs.

Thank you very much for the reply.
I have not implemented the solution you suggested in the post but I have one doubt related to it. If my application contains large number of nodes, upon loading the diagrams, when I want find some PartID from other goView each time it will take O(n) to find the node PartId. This will slow down the application because initially I used to refer to memory location(on heap) which was quick. But now I need to find PartId whenever I do some changes in any of the GoViews(goView1 or GoView2 node).
I am not sure how GoDocument.FindPart method finds the required PartId (i.e. node)? Will this approach of using PartID take the same time as that of the referencing to memory location while finding references in the nodes (when something is changed)?
Thank you…

FindPart uses a .NET Dictionary. I’d be surprised if you saw a noticeable difference.

Thank you very much…