private List <List <MemberInfo> > ResolveIncludePaths(string[] names, ref int depth, ref IEntityType entityType) { var navigations = entityType.FindDerivedNavigations(names[depth]); if (entityType.FindNavigation(names[depth]) is INavigation nonderived) { navigations = navigations.Prepend(nonderived); } var result = new List <List <MemberInfo> >(); if (!navigations.Any()) { return(result); } navigations = navigations.Distinct(); depth++; if (depth == names.Length) { depth--; result.AddRange(navigations.Select(n => new List <MemberInfo> { n.GetReadableMemberInfo() })); return(result); } foreach (var navigation in navigations) { var subtype = navigation.GetTargetType(); var success = false; var resolvedSubpaths = ResolveIncludePaths(names, ref depth, ref subtype); foreach (var subpath in resolvedSubpaths) { success |= (subpath.Count != 0); subpath.Insert(0, navigation.GetReadableMemberInfo()); result.Add(subpath); } if (!success) { entityType = subtype; } if (resolvedSubpaths.Count == 0) { result.Add(new List <MemberInfo> { navigation.GetReadableMemberInfo() }); } } return(result); }