Skip to content

Commit 4256fdb

Browse files
committed
Project structure
0 parents  commit 4256fdb

File tree

160 files changed

+11538
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

160 files changed

+11538
-0
lines changed

.gitignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
*.DS_Store
2+
3+
.vs/
4+
.vscode/
5+
.idea/
6+
*.user
7+
*.suo
8+
*.nupkg
9+
*.lock.json
10+
npm-debug.log
11+
bundle.js
12+
fixie-results.xml
13+
14+
TestResults/
15+
[Oo]bj/
16+
[Bb]in/
17+
packages/
18+
node_modules/
19+
nuget/lib

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "deps/graphql-dotnet"]
2+
path = deps/graphql-dotnet
3+
url = https://github.com/graphql-dotnet/graphql-dotnet.git

Conventions.sln

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
Microsoft Visual Studio Solution File, Format Version 12.00
2+
# Visual Studio 15
3+
VisualStudioVersion = 15.0.0.0
4+
MinimumVisualStudioVersion = 15.0.0.0
5+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GraphQL.Conventions", "src\GraphQL.Conventions\GraphQL.Conventions.csproj", "{AEAC9A4B-7D5B-48C6-86A9-E665F6DE4B6C}"
6+
EndProject
7+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "test\Tests\Tests.csproj", "{5CF44C73-E5C9-4E53-A69D-4013E8AE85E5}"
8+
EndProject
9+
Global
10+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
11+
Debug|Any CPU = Debug|Any CPU
12+
Debug|x64 = Debug|x64
13+
Debug|x86 = Debug|x86
14+
Release|Any CPU = Release|Any CPU
15+
Release|x64 = Release|x64
16+
Release|x86 = Release|x86
17+
EndGlobalSection
18+
GlobalSection(SolutionProperties) = preSolution
19+
HideSolutionNode = FALSE
20+
EndGlobalSection
21+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
22+
{AEAC9A4B-7D5B-48C6-86A9-E665F6DE4B6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23+
{AEAC9A4B-7D5B-48C6-86A9-E665F6DE4B6C}.Debug|Any CPU.Build.0 = Debug|Any CPU
24+
{AEAC9A4B-7D5B-48C6-86A9-E665F6DE4B6C}.Debug|x64.ActiveCfg = Debug|Any CPU
25+
{AEAC9A4B-7D5B-48C6-86A9-E665F6DE4B6C}.Debug|x64.Build.0 = Debug|Any CPU
26+
{AEAC9A4B-7D5B-48C6-86A9-E665F6DE4B6C}.Debug|x86.ActiveCfg = Debug|Any CPU
27+
{AEAC9A4B-7D5B-48C6-86A9-E665F6DE4B6C}.Debug|x86.Build.0 = Debug|Any CPU
28+
{AEAC9A4B-7D5B-48C6-86A9-E665F6DE4B6C}.Release|Any CPU.ActiveCfg = Release|Any CPU
29+
{AEAC9A4B-7D5B-48C6-86A9-E665F6DE4B6C}.Release|Any CPU.Build.0 = Release|Any CPU
30+
{AEAC9A4B-7D5B-48C6-86A9-E665F6DE4B6C}.Release|x64.ActiveCfg = Release|Any CPU
31+
{AEAC9A4B-7D5B-48C6-86A9-E665F6DE4B6C}.Release|x64.Build.0 = Release|Any CPU
32+
{AEAC9A4B-7D5B-48C6-86A9-E665F6DE4B6C}.Release|x86.ActiveCfg = Release|Any CPU
33+
{AEAC9A4B-7D5B-48C6-86A9-E665F6DE4B6C}.Release|x86.Build.0 = Release|Any CPU
34+
{5CF44C73-E5C9-4E53-A69D-4013E8AE85E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
35+
{5CF44C73-E5C9-4E53-A69D-4013E8AE85E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
36+
{5CF44C73-E5C9-4E53-A69D-4013E8AE85E5}.Debug|x64.ActiveCfg = Debug|Any CPU
37+
{5CF44C73-E5C9-4E53-A69D-4013E8AE85E5}.Debug|x64.Build.0 = Debug|Any CPU
38+
{5CF44C73-E5C9-4E53-A69D-4013E8AE85E5}.Debug|x86.ActiveCfg = Debug|Any CPU
39+
{5CF44C73-E5C9-4E53-A69D-4013E8AE85E5}.Debug|x86.Build.0 = Debug|Any CPU
40+
{5CF44C73-E5C9-4E53-A69D-4013E8AE85E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
41+
{5CF44C73-E5C9-4E53-A69D-4013E8AE85E5}.Release|Any CPU.Build.0 = Release|Any CPU
42+
{5CF44C73-E5C9-4E53-A69D-4013E8AE85E5}.Release|x64.ActiveCfg = Release|Any CPU
43+
{5CF44C73-E5C9-4E53-A69D-4013E8AE85E5}.Release|x64.Build.0 = Release|Any CPU
44+
{5CF44C73-E5C9-4E53-A69D-4013E8AE85E5}.Release|x86.ActiveCfg = Release|Any CPU
45+
{5CF44C73-E5C9-4E53-A69D-4013E8AE85E5}.Release|x86.Build.0 = Release|Any CPU
46+
EndGlobalSection
47+
EndGlobal

README.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
GraphQL Conventions Library for .NET
2+
====================================
3+
4+
## Introduction
5+
[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.
6+
7+
In short, this project builds on top of the following components:
8+
9+
* The [GraphQL](https://github.com/graphql-dotnet/graphql-dotnet) library written by [Joe McBride](https://github.com/joemcbride) (MIT licence)
10+
* The GraphQL [lexer/parser](http://github.com/graphql-dotnet/parser) originally written by [Marek Magdziak](https://github.com/mkmarek) (MIT licence)
11+
12+
## Installation
13+
14+
Download and install the package from [NuGet](https://www.nuget.org/packages/GraphQL.Conventions):
15+
16+
```powershell
17+
PS> Install-Package GraphQL.Conventions
18+
```
19+
20+
The following targets are available:
21+
22+
* .NET Framework 4.5
23+
* .NET Platform Standard 1.5
24+
25+
## Getting Started
26+
27+
Implement your query type:
28+
29+
```cs
30+
[ImplementViewer(OperationType.Query)]
31+
public class Query
32+
{
33+
[Description("Retrieve book by its globally unique ID.")]
34+
public Task<Book> Book(UserContext context, Id id) =>
35+
context.Get<Book>(id);
36+
37+
[Description("Retrieve author by his/her globally unique ID.")]
38+
public Task<Author> Author(UserContext context, Id id) =>
39+
context.Get<Author>(id);
40+
41+
[Description("Search for books and authors.")]
42+
public Connection<SearchResult> Search(
43+
UserContext context,
44+
[Description("Title or last name.")] NonNull<string> forString,
45+
[Description("Only return search results after given cursor.")] Cursor? after,
46+
[Description("Return the first N results.")] int? first)
47+
{
48+
return context
49+
.Search(forString.Value)
50+
.Select(node => new SearchResult { Instance = node })
51+
.ToConnection(first ?? 5, after);
52+
}
53+
}
54+
```
55+
56+
Construct your schema and run your query:
57+
58+
```cs
59+
using GraphQL.Conventions;
60+
61+
var engine = GraphQLEngine.New<Query>();
62+
var result = await engine
63+
.NewExecutor()
64+
.WithUserContext(userContext)
65+
.WithDependencyInjector(dependencyInjector)
66+
.WithRequest(requestBody)
67+
.Execute();
68+
```
69+
70+
## Examples
71+
72+
More detailed examples can be found in the [unit tests](https://github.com/graphql-dotnet/conventions/tree/master/test/GraphQL.Conventions.Tests) and the included [test server](https://github.com/graphql-dotnet/conventions/tree/master/test/GraphQL.Conventions.Tests.Server).

deps/graphql-dotnet

Submodule graphql-dotnet added at 4ae6334

global.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"projects": [
3+
"src",
4+
"test",
5+
"deps/graphql-dotnet/src"
6+
]
7+
}

0 commit comments

Comments
 (0)