diff --git a/src/EFCore.Cosmos/Query/Internal/CosmosValueConverterCompensatingExpressionVisitor.cs b/src/EFCore.Cosmos/Query/Internal/CosmosValueConverterCompensatingExpressionVisitor.cs index 716520df2d7..0a8ed87e404 100644 --- a/src/EFCore.Cosmos/Query/Internal/CosmosValueConverterCompensatingExpressionVisitor.cs +++ b/src/EFCore.Cosmos/Query/Internal/CosmosValueConverterCompensatingExpressionVisitor.cs @@ -72,7 +72,7 @@ private Expression VisitSelect(SelectExpression selectExpression) var fromExpression = (RootReferenceExpression)Visit(selectExpression.FromExpression); changed |= fromExpression != selectExpression.FromExpression; - var predicate = TryCompensateForBoolWithValueConverter(selectExpression.Predicate); + var predicate = TryCompensateForBoolWithValueConverter((SqlExpression)Visit(selectExpression.Predicate)); changed |= predicate != selectExpression.Predicate; var orderings = new List(); @@ -95,7 +95,7 @@ private Expression VisitSqlConditional(SqlConditionalExpression sqlConditionalEx { Check.NotNull(sqlConditionalExpression, nameof(sqlConditionalExpression)); - var test = TryCompensateForBoolWithValueConverter(sqlConditionalExpression.Test); + var test = TryCompensateForBoolWithValueConverter((SqlExpression)Visit(sqlConditionalExpression.Test)); var ifTrue = (SqlExpression)Visit(sqlConditionalExpression.IfTrue); var ifFalse = (SqlExpression)Visit(sqlConditionalExpression.IfFalse);