Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instanciate Pre-defined nodes automaticaly #2852

Open
2 of 5 tasks
william-hazem opened this issue Nov 19, 2024 · 0 comments
Open
2 of 5 tasks

Instanciate Pre-defined nodes automaticaly #2852

william-hazem opened this issue Nov 19, 2024 · 0 comments
Assignees

Comments

@william-hazem
Copy link

Type of issue

  • Bug
  • Enhancement
  • Compliance
  • Question
  • Help wanted

Current Behavior

Are there any mechanisms in the framework that allow handling pre-defined nodes, such as instances of custom object types in the model file (.xml)?

I have pre-defined instances in the .xml of a custom object type. In my custom node manager, I have hard-coded definitions and instances such that:

internal class MyNodeManager : CustomNodeManager2
    {
        private MyServerConfiguration mConfiguration;
        private static CustomTypeState1 mCustomObj1;
        private static CustomTypeState2 mCustomObj2;
        ...
public override void CreateAddressSpace(IDictionary<NodeId, IList<IReference>> externalReferences)
{
            lock (Lock)
            {
                LoadPredefinedNodes(SystemContext, externalReferences);

                BaseObjectState passiveNode = (BaseObjectState)FindPredefinedNode(new NodeId(yourorganisation.org.Planta.Objects.Object1, base.NamespaceIndexes[0]), typeof(BaseObjectState));
                BaseObjectState passiveNode2 = (BaseObjectState)FindPredefinedNode(new NodeId(yourorganisation.org.Planta.Objects.Object2, base.NamespaceIndexes[0]), typeof(BaseObjectState));
               ...
                mCustomObj1= new CustomTypeState1(null);
                mCustomObj1.Create(SystemContext, passiveNode);
                ...
                mCustomObj2 = new CustomTypeState2(null);
                mCustomObj2.Create(SystemContext, passiveNode2);
                ...
                AddPredefinedNode(SystemContext, mCustomObj1);
                AddPredefinedNode(SystemContext, mCustomObj2);
                ....
            }
}

For each node, I need to address it manually and manage every object ID, object type, and namespace and explicit instance. Is there any way to generalize this instantiation for any application? (Suppose there are hundreds of nodes and types in my application).

Expected Behavior

No response

Steps To Reproduce

No response

Environment

No response

Anything else?

No response

@mregen mregen self-assigned this Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants