File tree Expand file tree Collapse file tree
src/BLite.Client/Internal
tests/BLite.Client.IntegrationTests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ private static FilterNode ConvertFilter(Expression expr)
5959 BinaryExpression binary => ConvertBinary ( binary ) ,
6060 UnaryExpression { NodeType : ExpressionType . Not } unary => ConvertNot ( unary ) ,
6161 MethodCallExpression call => ConvertMethodCall ( call ) ,
62+ MemberExpression member => ConvertMemberAccess ( member ) ,
6263 // Handle invocations wrapping lambdas (from chained Where)
6364 InvocationExpression inv => ConvertFilter ( inv . Expression is LambdaExpression l ? l . Body : inv ) ,
6465 _ => throw new NotSupportedException (
@@ -194,6 +195,23 @@ private static FilterNode ConvertMethodCall(MethodCallExpression call)
194195 $ "Method '{ call . Method . DeclaringType ? . Name } .{ methodName } ' is not supported for remote query push-down.") ;
195196 }
196197
198+ private static FilterNode ConvertMemberAccess ( MemberExpression member )
199+ {
200+ var field = ExtractMemberName ( member ) ;
201+ if ( field is not null && member . Type == typeof ( bool ) )
202+ {
203+ return new BinaryFilter
204+ {
205+ Field = field ,
206+ Op = FilterOp . Eq ,
207+ Value = ScalarValue . From ( true )
208+ } ;
209+ }
210+
211+ throw new NotSupportedException (
212+ $ "Member access '{ member } ' is not supported for remote query push-down.") ;
213+ }
214+
197215 // ── Projection conversion ─────────────────────────────────────────────────
198216
199217 private static ProjectionSpec ConvertProjection ( LambdaExpression selectLambda )
Original file line number Diff line number Diff line change @@ -24,4 +24,6 @@ public class TestProduct
2424 public decimal Price { get ; set ; }
2525
2626 public int Stock { get ; set ; }
27+
28+ public bool Active { get ; set ; }
2729}
Original file line number Diff line number Diff line change @@ -42,7 +42,8 @@ await col.InsertAsync(new TestProduct
4242 Id = i ,
4343 Name = $ "Product{ i : D2} ",
4444 Price = i * 10.0m ,
45- Stock = i * 2
45+ Stock = i * 2 ,
46+ Active = i % 2 == 0
4647 } ) ;
4748
4849 return ( client , col ) ;
@@ -65,6 +66,20 @@ public async Task AsQueryable_Where_PushesFilterToServer()
6566 Assert . All ( results , p => Assert . True ( p . Stock > 4 ) ) ;
6667 }
6768
69+ [ Fact ]
70+ public async Task AsQueryable_Where_BooleanMemberAccess_PushesFilterToServer ( )
71+ {
72+ var ( client , col ) = await SetupWithProductsAsync ( ) ;
73+ await using var _ = client ;
74+
75+ var results = await col . AsQueryable ( )
76+ . Where ( p => p . Active )
77+ . ToListAsync ( ) ;
78+
79+ Assert . Equal ( 2 , results . Count ) ;
80+ Assert . All ( results , p => Assert . True ( p . Active ) ) ;
81+ }
82+
6883 [ Fact ]
6984 public async Task AsQueryable_OrderBy_ReturnsOrderedResults ( )
7085 {
You can’t perform that action at this time.
0 commit comments