The client provided me the model .XML file exported from the UAModeler and also the Code classes (ModelClasses.cs ModelIdentifiers.cs ModelTypes.cs) but I'm a little lost trying to find a dynamic way to construct the ObjectModel instance for each specfic node.
Looking the sample code provided by the SDK I can see that the most common way is calling the concrete constructor for the required type (commonly located in the ModelClasses.cs) like this:
Code: Select all
NodeId myNodeId = new NodeId("mynewnodename", DefaultNamespaceIndex);
BaseObjectModel myNodeModelType = new UnifiedAutomation.Demo.Model.BoilerModel(); //This can't be done in my scenario
LinkModelToNode(myNodeId, myNodeModelType, null, null, 0);
I need something like this:
Code: Select all
NodeId myNodeId = new NodeId("mynewnodename", DefaultNamespaceIndex);
BaseObjectModel myNodeModelType = ResolveObjectModelToBeUsed("nameofthemodeltype");
LinkModelToNode(myNodeId, myNodeModelType, null, null, 0);