private NavigationTreeNode( [NotNull] INavigation navigation, [NotNull] NavigationTreeNode parent, bool optional, bool include) { Check.NotNull(navigation, nameof(navigation)); Check.NotNull(parent, nameof(parent)); Navigation = navigation; Parent = parent; Optional = optional; ToMapping = new List <string>(); if (include) { ExpansionMode = NavigationTreeNodeExpansionMode.NotNeeded; Included = navigation.IsCollection() ? NavigationTreeNodeIncludeMode.Collection : NavigationTreeNodeIncludeMode.ReferencePending; } else { ExpansionMode = navigation.IsCollection() ? NavigationTreeNodeExpansionMode.Collection : NavigationTreeNodeExpansionMode.ReferencePending; Included = NavigationTreeNodeIncludeMode.NotNeeded; } foreach (var parentFromMapping in parent.FromMappings) { var newMapping = parentFromMapping.ToList(); newMapping.Add(navigation.Name); FromMappings.Add(newMapping); } }
private NavigationTreeNode( List <string> fromMapping, bool optional) { Optional = optional; FromMappings.Add(fromMapping.ToList()); ToMapping = fromMapping.ToList(); ExpansionMode = NavigationTreeNodeExpansionMode.ReferenceComplete; Included = NavigationTreeNodeIncludeMode.NotNeeded; }
private NavigationTreeNode( List <string> fromMapping, bool optional) { Optional = optional; FromMappings.Add(fromMapping.ToList()); ToMapping = fromMapping.ToList(); ExpansionState = NavigationState.Complete; IncludeState = NavigationState.NotNeeded; }
private NavigationTreeNode( [NotNull] INavigation navigation, [NotNull] NavigationTreeNode parent, bool optional, bool include) { Check.NotNull(navigation, nameof(navigation)); Check.NotNull(parent, nameof(parent)); Navigation = navigation; Parent = parent; Optional = optional; ToMapping = new List <string>(); IsCollection = navigation.IsCollection(); if (include) { ExpansionState = NavigationState.NotNeeded; IncludeState = NavigationState.Pending; } else { ExpansionState = NavigationState.Pending; IncludeState = NavigationState.NotNeeded; } // for ownership don't mark for include or expansion // just track the navigations in the tree in the original form // they will be expanded/translated later in the pipeline if (navigation.ForeignKey.IsOwnership) { if (include) { IncludeState = NavigationState.Delayed; } else { ExpansionState = NavigationState.Delayed; } ToMapping = parent.ToMapping.ToList(); ToMapping.Add(navigation.Name); } foreach (var parentFromMapping in parent.FromMappings) { var newMapping = parentFromMapping.ToList(); newMapping.Add(navigation.Name); FromMappings.Add(newMapping); } }