-
-
Notifications
You must be signed in to change notification settings - Fork 725
/
Query.cs
65 lines (58 loc) · 2.11 KB
/
Query.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
using System.Threading;
using System.Threading.Tasks;
using HotChocolate.Language;
namespace HotChocolate.Execution.Integration.DataLoader
{
public class Query
{
public Task<string> GetWithDataLoader(
string key,
FieldNode fieldSelection,
[DataLoader] TestDataLoader testDataLoader,
CancellationToken cancellationToken)
{
return testDataLoader.LoadAsync(key, cancellationToken);
}
public Bar Bar => new Bar();
public Task<string> GetWithDataLoader2(
string key,
FieldNode fieldSelection,
[DataLoader("fooBar")] TestDataLoader testDataLoader,
CancellationToken cancellationToken)
{
return testDataLoader.LoadAsync(key, cancellationToken);
}
public Task<string> GetDataLoaderWithInterface(
string key,
FieldNode fieldSelection,
ITestDataLoader testDataLoader,
CancellationToken cancellationToken)
{
return testDataLoader.LoadAsync(key, cancellationToken);
}
public async Task<string> GetWithStackedDataLoader(
string key,
FieldNode fieldSelection,
[DataLoader("fooBar")] TestDataLoader testDataLoader,
CancellationToken cancellationToken)
{
string s = await testDataLoader.LoadAsync(key + "a", cancellationToken);
s += await testDataLoader.LoadAsync(key + "b", cancellationToken);
s += await testDataLoader.LoadAsync(key + "c", cancellationToken);
s += await testDataLoader.LoadAsync(key + "d", cancellationToken);
s += await testDataLoader.LoadAsync(key + "e", cancellationToken);
return s;
}
}
public class Bar
{
public Task<string> GetWithDataLoader(
string key,
FieldNode fieldSelection,
[DataLoader] TestDataLoader testDataLoader,
CancellationToken cancellationToken)
{
return testDataLoader.LoadAsync(key, cancellationToken);
}
}
}