Update an InMemory node to change his ParentNodeId

Questions regarding the use of the .NET SDK 2.0 for Server or Client development or integration into customer products ...

Moderator: uasdknet

Post Reply
stephenTissot
Full Member
Full Member
Posts: 9
Joined: 24 Jan 2022, 17:13

Update an InMemory node to change his ParentNodeId

Post by stephenTissot »

Hello.

I need to update the node tree to reflect changes in our model. I am trying to update the ParentNodeId of an existing inmemory node but no change in the tree...
my code is :
node = _nodeManager.FindInMemoryNode(settings.RequestedNodeId) as ObjectNode;
node.ParentNodeId = NewParentNodeId;

Does anybody know if this tree update is possible, and how ?

Thanks
Stephen

User avatar
Support Team
Hero Member
Hero Member
Posts: 3064
Joined: 18 Mar 2011, 15:09

Re: Update an InMemory node to change his ParentNodeId

Post by Support Team »

Hello Stephen,

Just changing the ParentNodeId of the node instance will not have an effect once the node has been created. You need to delete the referene from the old parent to the node and create a new reference from the new parent node.

https://documentation.unified-automation.com/uasdknet/3.1.1/html/classUnifiedAutomation_1_1UaServer_1_1BaseNodeManager.html#a5bf560ed248fe09bfd0ed686a3a7361e
https://documentation.unified-automation.com/uasdknet/3.1.1/html/classUnifiedAutomation_1_1UaServer_1_1BaseNodeManager.html#ada052041be4314b7465d359041457298
Best regards
Unified Automation Support Team

Post Reply