/// <summary> /// Retrieves process list ordered by dependencies. /// </summary> /// <returns>The <see cref="IEnumerable" />.</returns> public IEnumerable<ProcessInfoDTO> FetchProcessListOrderedByDependencies() { var map = DependencyMap.Create(); var list = new SortedList<int, List<ProcessInfoDTO>>(); foreach (var r in map) { var count = map.GetAllDependencies(r).Count(x => x.IsStrongDependency); List<ProcessInfoDTO> l; if (list.ContainsKey(count)) { l = list[count]; } else { l = new List<ProcessInfoDTO>(); list.Add(count, l); } l.Add(r); } return list.SelectMany(l => l.Value).ToList(); }