예제 #1
0
        /// <summary>
        /// Get a dictionary of all DtoAttributeTopologies.
        /// </summary>
        /// <param name="integrationBase"></param>
        /// <param name="tenant"></param>
        /// <returns></returns>
        public static Dictionary <Guid, DtoAttributeTopology> ReadAttributeTopology(IntegrationBase integrationBase, bool tenant = false)
        {
            DtoAttributeTopology topology = integrationBase.ApiCore.GetAttributes(tenant);

            Dictionary <Guid, DtoAttributeTopology> dictionary = new Dictionary <Guid, DtoAttributeTopology>();

            WalkToTree(topology, ref dictionary);

            return(dictionary);
        }
예제 #2
0
        private static void WalkToTree(DtoAttributeTopology topology, ref Dictionary <Guid, DtoAttributeTopology> dictionary)
        {
            if (topology != null && topology.Children != null)
            {
                foreach (DtoAttributeTopology child in topology.Children)
                {
                    if (!dictionary.ContainsKey(child.Id))
                    {
                        dictionary.Add(child.Id, child);
                    }
                    else
                    {
#if DEBUG
                        Trace.WriteLine("WalkToTree - Unexpected branch");
#endif
                    }
                    if (child.Children != null)
                    {
                        WalkToTree(child, ref dictionary);
                    }
                }
            }
        }