Opc.Ua.Server.BaseInstanceSource.InitializeOptionalChild C# (CSharp) Method

InitializeOptionalChild() protected method

Initializes an optinal child based on what is in the address space.
protected InitializeOptionalChild ( ConstructInstanceDelegate constructInstanceDelegate, NodeId referenceTypeId, QualifiedName browseName, uint numericId, object configuration ) : BaseInstanceSource
constructInstanceDelegate ConstructInstanceDelegate
referenceTypeId NodeId
browseName QualifiedName
numericId uint
configuration object
return BaseInstanceSource
        protected BaseInstanceSource InitializeOptionalChild(
            ConstructInstanceDelegate constructInstanceDelegate,
            NodeId                    referenceTypeId,
            QualifiedName             browseName,
            uint                      numericId,
            object                    configuration)
        {
            CheckNodeManagerState();

            // check if nothing to do.
            if (constructInstanceDelegate == null)
            {
                return null;
            }

            // check if node exists.
            ILocalNode existingChild = NodeManager.GetTargetNode(
                this.NodeId, 
                referenceTypeId, 
                false, 
                true, 
                browseName) as ILocalNode;

            if (existingChild == null)
            {
                return null;
            }

            BaseInstanceSource child = constructInstanceDelegate(
                Server, 
                this, 
                referenceTypeId, 
                null, 
                browseName,
                numericId);
                                            
            // create it.
            child.Create(this.NodeId, child.ReferenceTypeId, null, null, numericId, configuration);

            return child;
        }