I am trying to AND multiple LINQ (rather lambda) Expressions into a where clause to query a local CosmosDb emulator.
The resulting query looks like this:
SELECT * FROM root
WHERE ((root["ActivityName"] IN ("Run")) & (root["CreatedByUser"]["Id"] IN (10023)))
ORDER BY root["CreatedOnUtc"] DESC
Note the bitwise & operator in the query. This leads to no results as the outcome despite of the fact that matching results actually exist in the CosmosDb.
When I run this query, I get the results
SELECT * FROM root
WHERE ((root["ActivityName"] IN ("Run")) AND (root["CreatedByUser"]["Id"] IN (10023)))
ORDER BY root["CreatedOnUtc"] DESC
The code that I am using to combine multiple lambda expressions is roughly:
Expression.And(first, second);
details for it can be found here:
How do I combine my Expressions to yield a query with logical AND instead of bit-wise &?
&&->Expression.AndAlso,||->Expression.OrElse