예제 #1
0
        public GraphQLDocument(GraphQLParser.AST.GraphQLDocument ast, IEnumerable <LocatedNamedSource> queryParts)
        {
            this.ast = ast;

            this.QueryParts = queryParts;
            var items = ast.Definitions.Select(Visit).ToList();

            this.Operations = items.OfType <Operation>().ToList();
            this.types      = items.OfType <IGraphQLType>().OrderBy(x => x.Name).ToList();

            foreach (var i in items.OfType <IGraphQLInitter>().Where(x => !(x is Operation)))
            {
                i.Resolve(this);
            }
            foreach (var i in items.OfType <Operation>())
            {
                i.Resolve(this);
            }
        }
예제 #2
0
        public GraphQLDocument(GraphQLParser.AST.GraphQLDocument ast, IEnumerable <LocatedNamedSource> queryParts, CodeGeneratorSettings settings)
        {
            this.ast = ast;

            this.QueryParts = queryParts;
            this.settings   = settings;
            List <object> items = ast.Definitions.Select(this.Visit).ToList();

            this.Operations = items.OfType <Operation>().ToList();
            this.types      = items.OfType <IGraphQLType>().GroupBy(x => x.Name).Select(x => x.First()).ToList();
            this.astPrinter = new AstPrinter(settings.TypeNameDirective);
            foreach (IGraphQLInitter i in items.OfType <IGraphQLInitter>().Where(x => !(x is Operation)))
            {
                i.Resolve(this);
            }
            foreach (Operation i in items.OfType <Operation>())
            {
                i.Resolve(this);
            }
        }