Dear Team,
When I write codes to create my custom object type and make multiple instances from that type,
I would write as follows:
var settings = new CreateObjectSettings()
{
ParentNodeId = parentFolder.NodeId,
ReferenceTypeId = ReferenceTypeIds.Organizes,
RequestedNodeId = new NodeId($"OBJ_{i:D3}", InstanceNamespaceIndex),
BrowseName = new QualifiedName($"OBJ_{i:D3}", InstanceNamespaceIndex),
TypeDefinitionId = new NodeId(MY_CUSTOM_OBJECT_TYPE_ID, TypeNamespaceIndex)
};
CreateObject(_serverNodeManager.Server.DefaultRequestContext, settings);
When you do this, all the node ids of the nodes under the objects instantiated from "MY_CUSTOM_OBJECT_TYPE_ID" are "string" type.
The string node id which actually is the path of the node (like BrowseName).
I want to assign numeric node id (for better performance)...
Is there any way for me to jump in the process creating the nodes and give numeric node id for each child nodes when they are instantiated?
P.S.
When I worked with UA Modeler, I could assign numeric node ids for all the custome object types and I could see all the instantiated objects has nodes with numeric node ids...
To assign numeric NodeId when I instantiate Custom Object Type
Moderator: uasdknet
-
- Full Member
- Posts: 6
- Joined: 21 Jul 2022, 01:58
- Support Team
- Hero Member
- Posts: 2892
- Joined: 18 Mar 2011, 15:09
Re: To assign numeric NodeId when I instantiate Custom Object Type
Hello,
you are right. Numeric NodeIds are more performant than String NodeIds.
By overriding the method BaseNodeManager.CreateNodeId (https://documentation.unified-automation.com/uasdknet/3.3.0/html/classUnifiedAutomation_1_1UaServer_1_1BaseNodeManager.html#abf3f2c6b58e79017ae81bf1edd90f40c) you can create the NodeIds in your application code.
you are right. Numeric NodeIds are more performant than String NodeIds.
By overriding the method BaseNodeManager.CreateNodeId (https://documentation.unified-automation.com/uasdknet/3.3.0/html/classUnifiedAutomation_1_1UaServer_1_1BaseNodeManager.html#abf3f2c6b58e79017ae81bf1edd90f40c) you can create the NodeIds in your application code.
Best regards
Unified Automation Support Team
Unified Automation Support Team
-
- Full Member
- Posts: 6
- Joined: 21 Jul 2022, 01:58
Re: To assign numeric NodeId when I instantiate Custom Object Type
Thank you support team!
I can override BaseNodeManager.CreateNodeId to set numerical node id.
One thing to remember as a small tip would be: (for later visitors)
You shouldn't set RequestedNodeId value in CreateObjectSettings, if you set, BaseNodeManager.CreateNodeId overriden never called.
I can override BaseNodeManager.CreateNodeId to set numerical node id.
One thing to remember as a small tip would be: (for later visitors)
You shouldn't set RequestedNodeId value in CreateObjectSettings, if you set, BaseNodeManager.CreateNodeId overriden never called.