示例#1
0
        public HotelQuery(HotelRepository hotelRepository)
        {
            Field <ListGraphType <HotelInterface> >("Hotels", resolve: context => hotelRepository.GetAllAsync());

            Field <FancyHotelType>(
                "Hotel",
                arguments: new QueryArguments(new QueryArgument <NonNullGraphType <IdGraphType> > {
                Name = "id"
            }),
                resolve: context =>
            {
                var id = context.GetArgument <int>("id");

                return(hotelRepository.GetOneAsync(id));
            }
                );
        }