Esempio n. 1
0
        /// <summary>
        /// Checks if the the child is for its parent.
        /// </summary>
        public bool ValidateChild(ISystemContext context, NodeState node)
        {
            // only need to validate once.
            node.OnValidate = null;

            BaseInstanceState child = node as BaseInstanceState;

            if (child == null)
            {
                return(true);
            }

            // validate the root node.
            NodeState parent = child.Parent;

            while (parent != null)
            {
                BaseInstanceState instance = parent as BaseInstanceState;

                if (instance == null || instance.Parent == null)
                {
                    return(parent.Validate(context));
                }

                parent = instance.Parent;
            }

            return(true);
        }
        /// <summary>
        /// Verifies that the specified node exists.
        /// </summary>
        protected virtual bool ValidateNode(ServerSystemContext context, NodeState node)
        {
            // validate node only if required.
            if (node.ValidationRequired)
            {
                return node.Validate(context);
            }

            return true;
        }