예제 #1
0
        public FrontendRoot(IProductRepo productRepo)
        {
            Name = "query";
            Field <ProductType>("product",
                                arguments: new QueryArguments(
                                    new QueryArgument <NonNullGraphType <IntGraphType> > {
                Name = "id", Description = "id of the product"
            }
                                    ),
                                resolve: context => productRepo.GetProduct(context.GetArgument <int>("id")));

            Field <ListGraphType <ProductType>, Product[]>().Name("all")
            .Resolve(context => productRepo.AllProducts());
        }