Skip to content

Commit 3e5a087

Browse files
committed
Squashed commit of the following:
commit cff18c4d385a70c65e22dec5cba4cf40cbe932fa Author: Simon Cropp <[email protected]> Date: Mon Mar 31 11:42:53 2025 +1100 . commit 334839c8165d6cbe09e46f249a7ece0e24185cad Author: Simon Cropp <[email protected]> Date: Mon Mar 31 11:38:26 2025 +1100 make filter work for nav property
1 parent 2ecc03f commit 3e5a087

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
target:
3+
{
4+
"data": {
5+
"level1Entities": [
6+
{
7+
"level2Entity": {
8+
"level3Entity": null
9+
}
10+
}
11+
]
12+
}
13+
},
14+
sql: {
15+
Text:
16+
select l.Id,
17+
l.Level2EntityId,
18+
l.Level2EntityId1,
19+
l0.Id,
20+
l0.Level3EntityId,
21+
l1.Id,
22+
l1.Property
23+
from Level1Entities as l
24+
left outer join
25+
Level2Entities as l0
26+
on l.Level2EntityId1 = l0.Id
27+
left outer join
28+
Level3Entities as l1
29+
on l0.Level3EntityId = l1.Id
30+
}
31+
}

src/Tests/IntegrationTests/IntegrationTests_filtered.cs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ static Filters<IntegrationDbContext> BuildFilters()
4242
var filters = new Filters<IntegrationDbContext>();
4343
filters.Add<FilterParentEntity>((_, _, _, item) => item.Property != "Ignore");
4444
filters.Add<FilterChildEntity>((_, _, _, item) => item.Property != "Ignore");
45+
filters.Add<Level3Entity>((_, _, _, item) => item.Property != "Ignore");
4546
return filters;
4647
}
4748

@@ -150,4 +151,40 @@ public async Task Connection_parent_child_Filtered()
150151
await using var database = await sqlInstance.Build();
151152
await RunQuery(database, query, null, BuildFilters(), false, [entity1, entity2, entity3]);
152153
}
154+
155+
[Fact]
156+
public async Task Multiple_nested_Filtered()
157+
{
158+
var query =
159+
"""
160+
{
161+
level1Entities
162+
{
163+
level2Entity
164+
{
165+
level3Entity
166+
{
167+
property
168+
}
169+
}
170+
}
171+
}
172+
""";
173+
174+
var level3 = new Level3Entity
175+
{
176+
Property = "Ignore"
177+
};
178+
var level2 = new Level2Entity
179+
{
180+
Level3Entity = level3
181+
};
182+
var level1 = new Level1Entity
183+
{
184+
Level2Entity = level2
185+
};
186+
187+
await using var database = await sqlInstance.Build();
188+
await RunQuery(database, query, null, BuildFilters(), false, [level1, level2, level3]);
189+
}
153190
}

0 commit comments

Comments
 (0)