Beispiel #1
0
        public QueryObject(
            IOilRefineryRepository oilRefineryRepository)
        {
            this.Name        = "Query";
            this.Description = "The query type, represents all of the entry points into our object graph.";

            this.FieldAsync <NonNullGraphType <ListGraphType <NonNullGraphType <OilRefineryObject> > >, List <OilRefinery> >(
                "parseOilRefineries",
                "Returns a list of oil refineries parsed from the input.",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <StringGraphType> >()
            {
                Name        = "input",
                Description = "The input to parse for oil refineries.",
            }),
                resolve: context =>
                oilRefineryRepository.ParseOilRefineries(
                    context.GetArgument <string>("input"),
                    context.CancellationToken)
                );

            // Just include static info for info query in this case as it's not hitting the dummy repository/database.
            this.Field <InfoObject>(
                "info",
                resolve: context =>
            {
                return(new Info
                {
                    Id = "ed7584-2124-98fs-00s3-t739478t",
                    Name = "maana.io.template",
                    Description = "Dockerized ASP.NET Core GraphQL Template"
                });
            });
        }
Beispiel #2
0
        public OilRefineryObject(IOilRefineryRepository oilRefineryRepository)
        {
            this.Name        = "OilRefinery";
            this.Description = "A place where oil is refined.";

            this.Field(x => x.Id, type: typeof(NonNullGraphType <IdGraphType>))
            .Description("The unique identifier of the oil refinery.");
            this.Field(x => x.Location, type: typeof(NonNullGraphType <StringGraphType>))
            .Description("The location of the oil refinery.");
            this.Field(x => x.Capacity, type: typeof(NonNullGraphType <FloatGraphType>))
            .Description("The capacity of the oil refinery.");
        }