{"id":13429484,"url":"https://github.com/graphql-dotnet/conventions","last_synced_at":"2025-05-14T18:07:37.080Z","repository":{"id":41225896,"uuid":"49303324","full_name":"graphql-dotnet/conventions","owner":"graphql-dotnet","description":"GraphQL Conventions Library for .NET","archived":false,"fork":false,"pushed_at":"2025-02-11T07:19:24.000Z","size":3690,"stargazers_count":232,"open_issues_count":13,"forks_count":63,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-04-15T01:56:40.006Z","etag":null,"topics":["api","conventions","dotnet","dotnetcore","graphql","schema"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/graphql-dotnet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["tlil"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2016-01-08T23:56:46.000Z","updated_at":"2025-02-11T07:15:40.000Z","dependencies_parsed_at":"2024-01-02T22:43:26.564Z","dependency_job_id":"f1fa9a7f-e2c7-4c68-8c70-fcb6eef93d79","html_url":"https://github.com/graphql-dotnet/conventions","commit_stats":{"total_commits":214,"total_committers":36,"mean_commits":5.944444444444445,"dds":0.5654205607476636,"last_synced_commit":"f6cbc6e8f567b7f9e147dd22f5fc3721f02ebab7"},"previous_names":[],"tags_count":75,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-dotnet%2Fconventions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-dotnet%2Fconventions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-dotnet%2Fconventions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-dotnet%2Fconventions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/graphql-dotnet","download_url":"https://codeload.github.com/graphql-dotnet/conventions/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254198514,"owners_count":22030966,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","conventions","dotnet","dotnetcore","graphql","schema"],"created_at":"2024-07-31T02:00:40.392Z","updated_at":"2025-05-14T18:07:32.072Z","avatar_url":"https://github.com/graphql-dotnet.png","language":"C#","funding_links":["https://github.com/sponsors/tlil"],"categories":["Frameworks, Libraries and Tools","api","Libraries","graphql","框架, 库和工具","API"],"sub_categories":["API",".NET Libraries"],"readme":"GraphQL Conventions Library for .NET\n====================================\n\n## Introduction\n[GraphQL .NET](https://www.github.com/graphql-dotnet/graphql-dotnet) 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.\n\nIn short, this project builds on top of the following components:\n\n * The [GraphQL](https://github.com/graphql-dotnet/graphql-dotnet) library written by [Joe McBride](https://github.com/joemcbride) (MIT licence)\n * The GraphQL [lexer/parser](http://github.com/graphql-dotnet/parser) originally written by [Marek Magdziak](https://github.com/mkmarek) (MIT licence)\n\n\u003e**Disclaimer:**\n\u003eI am providing code in this repository to you under an open source licence ([MIT](LICENSE.md)). Because this is my personal repository, the licence you receive to my code is from me and not my employer (Facebook).\n\n## Installation\n\nDownload and install the package from [NuGet](https://www.nuget.org/packages/GraphQL.Conventions):\n\n```powershell\nPS\u003e Install-Package GraphQL.Conventions\n```\n\nThis project targets [.NET Standard] 2.0.\n\n[.NET Standard]: https://docs.microsoft.com/en-us/dotnet/standard/net-standard\n\n## Getting Started\n\nImplement your query type:\n\n```cs\n[ImplementViewer(OperationType.Query)]\npublic class Query\n{\n    [Description(\"Retrieve book by its globally unique ID.\")]\n    public Task\u003cBook\u003e Book(UserContext context, Id id) =\u003e\n        context.Get\u003cBook\u003e(id);\n\n    [Description(\"Retrieve author by his/her globally unique ID.\")]\n    public Task\u003cAuthor\u003e Author(UserContext context, Id id) =\u003e\n        context.Get\u003cAuthor\u003e(id);\n\n    [Description(\"Search for books and authors.\")]\n    public Connection\u003cSearchResult\u003e Search(\n        UserContext context,\n        [Description(\"Title or last name.\")] NonNull\u003cstring\u003e forString,\n        [Description(\"Only return search results after given cursor.\")] Cursor? after,\n        [Description(\"Return the first N results.\")] int? first)\n    {\n        return context\n            .Search(forString.Value)\n            .Select(node =\u003e new SearchResult { Instance = node })\n            .ToConnection(first ?? 5, after);\n    }\n}\n```\n\nConstruct your schema and run your query:\n\n```cs\nusing GraphQL.Conventions;\n\nvar engine = GraphQLEngine.New\u003cQuery\u003e();\nvar result = await engine\n    .NewExecutor()\n    .WithUserContext(userContext)\n    .WithDependencyInjector(dependencyInjector)\n    .WithRequest(requestBody)\n    .Execute();\n```\n\n## Examples\n\nMore detailed examples can be found in the [unit tests](https://github.com/graphql-dotnet/conventions/tree/master/test/GraphQL.Conventions.Tests).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphql-dotnet%2Fconventions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgraphql-dotnet%2Fconventions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphql-dotnet%2Fconventions/lists"}