Opc.Ua.Server.CustomNodeManager2.DeleteReference C# (CSharp) Method

DeleteReference() public method

This method is used to delete bi-directional references to nodes from other node managers.
public DeleteReference ( object sourceHandle, Opc.Ua.NodeId referenceTypeId, bool isInverse, Opc.Ua.ExpandedNodeId targetId, bool deleteBiDirectional ) : ServiceResult
sourceHandle object
referenceTypeId Opc.Ua.NodeId
isInverse bool
targetId Opc.Ua.ExpandedNodeId
deleteBiDirectional bool
return Opc.Ua.ServiceResult
        public virtual ServiceResult DeleteReference(
            object         sourceHandle, 
            NodeId         referenceTypeId, 
            bool           isInverse, 
            ExpandedNodeId targetId, 
            bool           deleteBiDirectional)
        {
            lock (Lock)
            {
                // get the handle.
                NodeHandle source = IsHandleInNamespace(sourceHandle);

                if (source == null)
                {
                    return StatusCodes.BadNodeIdUnknown;
                }

                // only support external references to nodes that are stored in memory.
                if (!source.Validated || source.Node == null)
                {
                    return StatusCodes.BadNotSupported;
                }
                
                // only support references to Source Areas.
                source.Node.RemoveReference(referenceTypeId, isInverse, targetId);

                if (deleteBiDirectional)
                {
                    // check if the target is also managed by this node manager.
                    if (!targetId.IsAbsolute)
                    {
                        NodeHandle target = GetManagerHandle(m_systemContext, (NodeId)targetId, null);

                        if (target != null && target.Validated && target.Node != null)
                        {
                            target.Node.RemoveReference(referenceTypeId, !isInverse, source.NodeId);
                        }
                    }
                }

                return ServiceResult.Good;
            }
        }
CustomNodeManager2