You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GraphQL .NET has been around for a while. This library is a complementary layer on top that allows you to automatically wrap your .NET classes into GraphQL schema definitions using existing property getters and methods as field resolvers.
In short, this project builds on top of the following components:
Disclaimer:
I am providing code in this repository to you under an open source licence (MIT). Because this is my personal repository, the licence you receive to my code is from me and not my employer (Facebook).
[ImplementViewer(OperationType.Query)]publicclassQuery{[Description("Retrieve book by its globally unique ID.")]publicTask<Book>Book(UserContextcontext,Idid)=>context.Get<Book>(id);[Description("Retrieve author by his/her globally unique ID.")]publicTask<Author>Author(UserContextcontext,Idid)=>context.Get<Author>(id);[Description("Search for books and authors.")]publicConnection<SearchResult>Search(UserContextcontext,[Description("Title or last name.")]NonNull<string>forString,[Description("Only return search results after given cursor.")]Cursor?after,[Description("Return the first N results.")]int?first){returncontext.Search(forString.Value).Select(node =>newSearchResult{Instance=node}).ToConnection(first??5,after);}}