Beispiel #1
0
        private FieldType GetFieldDef(ISchema schema, IGraphType parentType, Field field)
        {
            var name = field.Name;

            if (name == SchemaIntrospection.SchemaMeta.Name &&
                Equals(schema.Query, parentType))
            {
                return(SchemaIntrospection.SchemaMeta);
            }

            if (name == SchemaIntrospection.TypeMeta.Name &&
                Equals(schema.Query, parentType))
            {
                return(SchemaIntrospection.TypeMeta);
            }

            if (name == SchemaIntrospection.TypeNameMeta.Name && parentType.IsCompositeType())
            {
                return(SchemaIntrospection.TypeNameMeta);
            }

            if (parentType is IObjectGraphType || parentType is IInterfaceGraphType)
            {
                var complexType = (IComplexGraphType)parentType;

                return(complexType.GetField(field.Name));
            }

            return(null);
        }