public Type GetType(GraphQLScalarType type) { if (type is GraphQLList) { return(ReflectionUtilities.CreateListTypeOf(this.GetType(((GraphQLList)type).MemberType))); } var reflectedType = this.bindings .Where(e => IsMatchingValueType(type, e.Value)) .Select(e => e.Key) .SingleOrDefault(); if (reflectedType == null) { if (type is GraphQLNonNullType) { reflectedType = this.schemaObserver.GetTypeFor(((GraphQLNonNullType)type).UnderlyingNullableType); } else { reflectedType = this.schemaObserver.GetTypeFor(type); } } return(reflectedType); }
public static IList CreateOutputList(GraphQLInputType inputType, ISchemaRepository schemaRepository) { IList output = (IList)Activator.CreateInstance( ReflectionUtilities.CreateListTypeOf( schemaRepository.GetInputSystemTypeFor(inputType))); return(output); }
private Type GetSystemTypeFor(GraphQLBaseType type) { if (type is GraphQLList) { return(ReflectionUtilities.CreateListTypeOf( this.GetInputSystemTypeFor(((GraphQLList)type).MemberType))); } var reflectedType = this.inputBindings .Where(e => e.Value.Name == type.Name) .Select(e => e.Key) .FirstOrDefault(); return(reflectedType); }