Ejemplo n.º 1
0
        public BooksQuery()
        {
            IBooksRepository bookRepository = new BooksRepository();

            this.Field <BookType>(
                "book",
                arguments: new QueryArguments(new QueryArgument <StringGraphType> {
                Name = "isbn"
            }),
                resolve: context =>
            {
                var id = context.GetArgument <string>("isbn");
                return(bookRepository.BookByIsbn(id));
            });

            this.Field <ListGraphType <BookType> >(
                "books",
                resolve: context => bookRepository.AllBooks());
        }