GetMostSpecificFieldResolvers( ITypeRegistry typeRegistry, IEnumerable <IFieldResolverDescriptor> resolverDescriptors) { foreach (IGrouping <FieldReference, IFieldResolverDescriptor> resolverGroup in resolverDescriptors.GroupBy(r => r.Field.ToFieldReference())) { FieldReference fieldReference = resolverGroup.Key; if (typeRegistry.TryGetObjectTypeField( fieldReference, out ObjectField field)) { foreach (DescriptorWithArguments descriptor in resolverGroup .Select(t => new DescriptorWithArguments(t)) .OrderByDescending(t => t.Arguments.Count)) { if (AllArgumentsMatch(field, descriptor.Arguments)) { yield return(descriptor.ResolverDescriptor); break; } } } } }
private IEnumerable <FieldResolverDescriptor> GetMostSpecificFieldResolvers( ITypeRegistry typeRegistry, IEnumerable <FieldResolverDescriptor> resolverDescriptors) { foreach (var resolverGroup in resolverDescriptors.GroupBy(r => r.Field)) { FieldReference fieldReference = resolverGroup.Key; if (typeRegistry.TryGetObjectTypeField(fieldReference, out Field field)) { foreach (FieldResolverDescriptor resolverDescriptor in resolverGroup.OrderByDescending(t => t.ArgumentCount())) { if (AllArgumentsMatch(field, resolverDescriptor)) { yield return(resolverDescriptor); break; } } } } }