Example #1
0
        /// <summary>
        /// 必须要同一级的节点才能加入到实体列表中。
        /// Test:TET_Query_LoadSubTreeIgnoreOtherNodes
        /// </summary>
        /// <param name="list"></param>
        /// <param name="node"></param>
        /// <param name="indexOption"></param>
        private static bool TryAddToList(IList <Entity> list, Entity node, TreeIndexOption indexOption)
        {
            if (list.Count > 0)
            {
                var listLevel = indexOption.CountLevel(list[0].TreeIndex);
                var nodeLevel = indexOption.CountLevel(node.TreeIndex);
                if (listLevel == nodeLevel)
                {
                    list.Add(node);
                    return(true);
                }
            }
            else
            {
                list.Add(node);
                return(true);
            }

            return(false);
        }