public async Task <GraphQLOutput> Query(GraphQLQuery query) { GraphQLOutput output = null; try { var executionOptions = new ExecutionOptions() { Schema = Schema, Query = query.Query, Inputs = query.GetInputs() }; var executionResult = await Executer.ExecuteAsync(executionOptions); output = new GraphQLOutput(executionResult.Data, executionResult.Errors?.ToArray()); } catch (Exception ex) { output = new GraphQLOutput(null, new[] { new ExecutionError("Controller exception", ex), }); } if (!DisplayStackTrace && output.Errors != null) { foreach (var error in output.Errors) { error.StackTrace = null; } } return(output); }
private string RunOperation(string query, Inputs inputs) { var executionResult = Executer.ExecuteAsync(Schema, null, query, null, inputs: inputs).Result; var output = new GraphQLOutput(executionResult.Data, executionResult.Errors?.ToArray()); return(JsonConvert.SerializeObject(output, SerializerSettings)); }