-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9115ef9
commit f686c16
Showing
10 changed files
with
156 additions
and
0 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
src/Tests/IntegrationTests/Graphs/CustomOrder/CustomOrderChildEntity.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
public class CustomOrderChildEntity | ||
{ | ||
public Guid Id { get; set; } = Guid.NewGuid(); | ||
public Guid? ParentId { get; set; } | ||
public CustomOrderParentEntity? Parent { get; set; } | ||
} |
7 changes: 7 additions & 0 deletions
7
src/Tests/IntegrationTests/Graphs/CustomOrder/CustomOrderChildGraphType.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
public class CustomOrderChildGraphType : | ||
EfObjectGraphType<IntegrationDbContext, CustomOrderChildEntity> | ||
{ | ||
public CustomOrderChildGraphType(IEfGraphQLService<IntegrationDbContext> graphQlService) : | ||
base(graphQlService) => | ||
AutoMap(); | ||
} |
5 changes: 5 additions & 0 deletions
5
src/Tests/IntegrationTests/Graphs/CustomOrder/CustomOrderParentEntity.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
public class CustomOrderParentEntity | ||
{ | ||
public Guid Id { get; set; } = Guid.NewGuid(); | ||
public IList<CustomOrderChildEntity> Children { get; set; } = []; | ||
} |
17 changes: 17 additions & 0 deletions
17
src/Tests/IntegrationTests/Graphs/CustomOrder/CustomOrderParentGraphType.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
public class CustomOrderParentGraphType : | ||
EfObjectGraphType<IntegrationDbContext, CustomOrderParentEntity> | ||
{ | ||
public CustomOrderParentGraphType(IEfGraphQLService<IntegrationDbContext> graphQlService) : | ||
base(graphQlService) | ||
{ | ||
AddQueryField( | ||
name: "customOrderChildren", | ||
resolve: context => | ||
{ | ||
var parentId = context.Source.Id; | ||
return context.DbContext.CustomOrderChildEntities | ||
.Where(_ => _.ParentId == parentId); | ||
}); | ||
AutoMap(); | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
src/Tests/IntegrationTests/IntegrationTests.CustomOrder.verified.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
{ | ||
target: | ||
{ | ||
"data": { | ||
"customOrder": [ | ||
{ | ||
"customOrderChildren": [ | ||
{ | ||
"id": "Guid_1" | ||
}, | ||
{ | ||
"id": "Guid_2" | ||
} | ||
] | ||
}, | ||
{ | ||
"customOrderChildren": [ | ||
{ | ||
"id": "Guid_3" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
sql: [ | ||
{ | ||
Text: | ||
SELECT [c].[Id] | ||
FROM [CustomOrderParentEntities] AS [c], | ||
HasTransaction: false | ||
}, | ||
{ | ||
Text: | ||
SELECT [c].[Id], [c].[ParentId] | ||
FROM [CustomOrderChildEntities] AS [c] | ||
WHERE [c].[ParentId] = @__parentId_0, | ||
Parameters: { | ||
@__parentId_0: { | ||
Value: Guid_4, | ||
IsNullable: true | ||
} | ||
}, | ||
HasTransaction: false | ||
}, | ||
{ | ||
Text: | ||
SELECT [c].[Id], [c].[ParentId] | ||
FROM [CustomOrderChildEntities] AS [c] | ||
WHERE [c].[ParentId] = @__parentId_0, | ||
Parameters: { | ||
@__parentId_0: { | ||
Value: Guid_5, | ||
IsNullable: true | ||
} | ||
}, | ||
HasTransaction: false | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters