Diagram node data getting reset

I dragged a node . Did some changes in node data(model).After I try to link the node to some other node . If the link is invalid . the changes made to node data are rolled back and getting set to previous value.

Did you make your changes within a transaction?

If you didn’t, those changes would be gathered together with the changes made during the linking operation. If that were to be rolled-back, or upon success and later undo, your initial changes would be included with the linking changes.

I am not making changes within a transaction . where , in which method do I need to add transaction for node data(model) changes

Whenever you make a change to a model or its data in response to some event, you should do so within a transaction. You can call the StartTransaction and CommitTransaction methods on the model or on the diagram. There are lots of examples of this in the samples. Also note that some Diagram events occur within a transaction – the documentation will say.