public async void Execute(GraphQLArgs args) { using (var conn = this.connectionFactory()) using (var session = SqlSession.Open(conn)) { var repo = new SqlRepository(session); this.container.Register <IRepository>(() => repo); this.container.Register <CalicoQuery>(); this.container.Register <Graph.Types.Attribute>(); this.container.Register <Graph.Types.Tenant>(); this.container.Register <Graph.Types.DataSet>(); this.container.Register <Graph.Types.DataType>(); this.container.Register <Graph.Types.FeatureType>(); this.container.Register <Graph.Types.Plot>(); var schema = new CalicoSchema( x => (GraphType)this.container.GetInstance(x)); var q = $"query{args.Query}"; var result = await new DocumentExecuter().ExecuteAsync(x => { x.Schema = schema; x.Query = q; }).ConfigureAwait(false); var json = new DocumentWriter(indent: true).Write(result); Console.WriteLine(json); } }
public GraphQLController(CalicoSchema schema) { this.schema = schema; }