protected static void AddLoadPath( IncludeLoadTreeNodeBase node, IReadOnlyList <INavigation> navigationPath, int index) { while (index < navigationPath.Count) { var navigation = navigationPath[index]; var childNode = node.Children.SingleOrDefault(n => n.Navigation == navigation); if (childNode == null) { node.Children.Add(childNode = new IncludeLoadTreeNode(navigation)); var targetType = navigation.GetTargetType(); var outboundNavigations = targetType.GetNavigations() .Concat(targetType.GetDerivedTypes().SelectMany(et => et.GetDeclaredNavigations())) .Where(n => n.IsEagerLoaded); foreach (var outboundNavigation in outboundNavigations) { AddLoadPath(childNode, new[] { outboundNavigation }, index: 0); } } node = childNode; index = index + 1; } }
protected static void AddLoadPath( IncludeLoadTreeNodeBase node, IReadOnlyList <INavigation> navigationPath, int index) { while (index < navigationPath.Count) { var navigation = navigationPath[index]; var childNode = node.Children.SingleOrDefault(n => n.Navigation == navigation); if (childNode == null) { node.Children.Add(childNode = new IncludeLoadTreeNode(navigation)); } node = childNode; index = index + 1; } }