public override IEnumerable <Relation <Object, string> > GetRelations(Object entity) { if (!graph.ContainsKey(entity)) { yield break; } foreach (var node in graph[entity]) { yield return(new Relation <Object, string>(entity, node, string.Empty)); } }
private void CollectConflictsBetweenFieldsAndFragment( ValidationContext context, List <Conflict> conflicts, Dictionary <SelectionSet, CachedField> cachedFieldsAndFragmentNames, ObjMap <bool> comparedFragments, PairSet comparedFragmentPairs, bool areMutuallyExclusive, Dictionary <string, List <FieldDefPair> > fieldMap, string fragmentName) { // Memoize so a fragment is not compared for conflicts more than once. if (comparedFragments.ContainsKey(fragmentName)) { return; } comparedFragments[fragmentName] = true; FragmentDefinition fragment = context.GetFragment(fragmentName); if (fragment == null) { return; } var cachedField = GetReferencedFieldsAndFragmentNames( context, cachedFieldsAndFragmentNames, fragment); var fieldMap2 = cachedField.NodeAndDef; var fragmentNames2 = cachedField.Names; // Do not compare a fragment's fieldMap to itself. if (fieldMap == fieldMap2) { return; } // (D) First collect any conflicts between the provided collection of fields // and the collection of fields represented by the given fragment. CollectConflictsBetween( context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap, fieldMap2); // (E) Then collect any conflicts between the provided collection of fields // and any fragment names found in the given fragment. for (var i = 0; i < fragmentNames2.Count; i++) { CollectConflictsBetweenFieldsAndFragment( context, conflicts, cachedFieldsAndFragmentNames, comparedFragments, comparedFragmentPairs, areMutuallyExclusive, fieldMap, fragmentNames2[i]); } }