@@ -35,8 +35,9 @@ internal static class ExpressionParserUtilities
3535 /// Get's the operand string.
3636 /// </summary>
3737 /// <param name="exp">the expression to parse.</param>
38+ /// <param name="filterFormat">whether the operand should be filter formatted.</param>
3839 /// <returns>The operand string.</returns>
39- internal static string GetOperandString ( Expression exp )
40+ internal static string GetOperandString ( Expression exp , bool filterFormat = false )
4041 {
4142 return exp switch
4243 {
@@ -46,7 +47,7 @@ internal static string GetOperandString(Expression exp)
4647 $ "@{ ( ( ConstantExpression ) method . Arguments [ 0 ] ) . Value } ",
4748 MethodCallExpression method => GetOperandString ( method ) ,
4849 UnaryExpression unary => GetOperandString ( unary . Operand ) ,
49- BinaryExpression binExpression => ParseBinaryExpression ( binExpression ) ,
50+ BinaryExpression binExpression => ParseBinaryExpression ( binExpression , filterFormat ) ,
5051 LambdaExpression lambda => GetOperandString ( lambda . Body ) ,
5152 _ => string . Empty
5253 } ;
@@ -156,8 +157,8 @@ internal static string ParseBinaryExpression(BinaryExpression rootBinaryExpressi
156157 var binExpressions = SplitBinaryExpression ( rootBinaryExpression ) ;
157158 foreach ( var expression in binExpressions )
158159 {
159- var right = GetOperandString ( expression . Right ) ;
160- var left = GetOperandString ( expression . Left ) ;
160+ var right = GetOperandString ( expression . Right , filterFormat ) ;
161+ var left = GetOperandString ( expression . Left , filterFormat ) ;
161162 if ( filterFormat && ( ( expression . Left is MemberExpression mem &&
162163 mem . Type == typeof ( string ) ) || ( expression . Left is UnaryExpression uni &&
163164 uni . Type == typeof ( string ) ) ) )
@@ -678,7 +679,7 @@ private static string TranslateFormatMethodStandardQuerySyntax(MethodCallExpress
678679 string [ ] args ;
679680 if ( exp . Arguments [ 1 ] is NewArrayExpression newArrayExpression )
680681 {
681- args = newArrayExpression . Expressions . Select ( GetOperandString ) . ToArray ( ) ;
682+ args = newArrayExpression . Expressions . Select ( x => GetOperandString ( x ) ) . ToArray ( ) ;
682683 }
683684 else
684685 {
0 commit comments