graphql-dotnet / graphql-dotnet/relay
How do you use NodeGraphType to define an Interface
- Dominant language
- C#
- Stars
- 74
- Forks
- 28
- PR merge metrics
- No merged PRs in 30d
Description
I would like to use `NodeGraphType` to implement the `NodeInterface` type. I'm trying to get my head around why `NodeGraphType` exists and how to use it. I think it:
1. Implements `Interface();` for you.
2. Implements the If field for you using `Id(x => x.Id)` instead of defining it yourself:
```
this.Field(x => x.Id, type: typeof(NonNullGraphType))
.Description("The unique identifier of the droid.");
```
3. Registers the type globally, so that given you implement `QueryGraphType`, lets you resolve any object globally by it's ID.
I've also found a few problems:
1. It assumes that the ID is of type string. Can I use a `System.Guid` instead?
2. The GetById is not async and does not accept a `CancellationToken`. Ideally it should have the signature:
```
Task GetById(T id, CancellationToken cancellationToken = default);
```
Where `T` is a generic type to allow you to specify the type of the ID. Allowing you to use a `Guid`.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.