-
Notifications
You must be signed in to change notification settings - Fork 64
/
Copy pathMultiContextQuery.cs
41 lines (41 loc) · 1.32 KB
/
MultiContextQuery.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
public class MultiContextQuery :
ObjectGraphType
{
public MultiContextQuery(
IEfGraphQLService<DbContext1> efGraphQlService1,
IEfGraphQLService<DbContext2> efGraphQlService2)
{
efGraphQlService1.AddSingleField(
graph: this,
name: "entity1",
resolve: context =>
{
var userContext = (UserContext) context.UserContext;
return userContext.DbContext1.Entities;
});
efGraphQlService1.AddFirstField(
graph: this,
name: "entity1First",
resolve: context =>
{
var userContext = (UserContext) context.UserContext;
return userContext.DbContext1.Entities;
});
efGraphQlService2.AddSingleField(
graph: this,
name: "entity2",
resolve: context =>
{
var userContext = (UserContext) context.UserContext;
return userContext.DbContext2.Entities;
});
efGraphQlService2.AddFirstField(
graph: this,
name: "entity2First",
resolve: context =>
{
var userContext = (UserContext) context.UserContext;
return userContext.DbContext2.Entities;
});
}
}