Ejemplo n.º 1
0
        /// <summary>
        /// Builds the symbolic identifier.
        /// </summary>
        /// <param name="path">The browse path.</param>
        public void BuildSymbolicId(List <string> path)
        {
            if (this.UANode == null)
            {
                Log.TraceEvent(TraceMessage.BuildErrorTraceMessage(BuildError.DanglingReferenceTarget, $"The target node NodeId={this.NodeIdContext}, current path {string.Join(", ", path)}"));
                return;
            }
            IEnumerable <UAReferenceContext> _parentConnector = m_AddressSpaceContext.GetReferences2Me(this).Where <UAReferenceContext>(x => x.ChildConnector);

            Debug.Assert(_parentConnector.Count <UAReferenceContext>() <= 1); //TODO #40; ValidateAndExportModel shall export also instances #40
            UAReferenceContext _connector = _parentConnector.FirstOrDefault <UAReferenceContext>();

            if (_connector != null)
            {
                _connector.BuildSymbolicId(path);
            }
            string _BranchName = string.IsNullOrEmpty(this.UANode.SymbolicName) ? this.BrowseName.Name : this.UANode.SymbolicName;

            path.Add(_BranchName);
        }
        /// <summary>
        /// Builds the symbolic identifier.
        /// </summary>
        /// <param name="path">The browse path.</param>
        /// <param name="traceEvent">A delegate <see cref="Action{TraceMessage}"/> encapsulates an action to report any errors and trace processing progress.</param>
        internal void BuildSymbolicId(List <string> path, Action <TraceMessage> traceEvent)
        {
            if (this.UANode == null)
            {
                traceEvent(TraceMessage.BuildErrorTraceMessage(BuildError.DanglingReferenceTarget, ""));
                return;
            }
            IEnumerable <UAReferenceContext> _parentConnector = m_AddressSpaceContext.GetReferences2Me(this).Where <UAReferenceContext>(x => x.ChildConnector);

            Debug.Assert(_parentConnector.Count <UAReferenceContext>() <= 1);
            UAReferenceContext _connector = _parentConnector.FirstOrDefault <UAReferenceContext>();

            if (_connector != null)
            {
                _connector.BuildSymbolicId(path, traceEvent);
            }
            string _BranchName = String.IsNullOrEmpty(this.UANode.SymbolicName) ? this.m_BrowseName.Name : this.UANode.SymbolicName;

            path.Add(_BranchName);
        }