Model Initialization from Xml data?


I test Goxam (wpf) to create a modeling appication.

I have the model below:

<br />Public Class GraphMOPModèle <br /> Inherits GraphLinksModel(Of MOP_Node, String, String, MOP_Link) <br /> <br />End Class <br /> <br /> <br />Public Class MOP_Node <br /> Inherits GraphLinksModelNodeData(Of String) <br /> <br />End Class <br /> <br /> <br />Public Class MOP_Link <br /> Inherits GraphLinksModelLinkData(Of String, String) <br /> <br />#Region "Modèle (GraphMOPModèle)" <br /> Private _Modèle As GraphMOPModèle <br /> Public Property Modèle() As GraphMOPModèle <br /> Get <br /> Return _Modèle <br /> End Get <br /> Friend Set(ByVal value As GraphMOPModèle) <br /> _Modèle = value <br /> End Set <br /> End Property <br />#End Region <br /> <br />#Region "LoadFromXElement" <br /> <br /> Public Overrides Sub LoadFromXElement(ByVal e As System.Xml.Linq.XElement) <br /> Me.Modèle = UC_MOPModelEditor.modèleCourant <br /> MyBase.LoadFromXElement(e) <br /> <br /> Dim nodeFrom = Me.Modèle.GetFromNodeForLink(Me) ' Nothing <br /> Dim nodeFrom2 = Me.Modèle.FindNodeByKey("value of from attribute in xml data") ' Is not Nothing <br /> End Sub <br /> <br />#End Region <br />End Class <br />

When I load the model from xml saved data, in the LoadFromXElement method, I don’t understand why Me.Modèle.GetFromNodeForLink(Me) is Nothing ?


I believe that it’s too early to call GetFromNodeForLink. That’s because the link data’s properties have been loaded from XML, but the link data itself has not yet been added to the model.

After the call to model.Load(…) I think GetFromNodeForLink should work.