@@ -196,6 +196,7 @@ private static Expression CreateRightExprFromType(Type leftExprType, string righ
196196
197197 if ( right . StartsWith ( "[" ) && right . EndsWith ( "]" ) )
198198 {
199+ targetType = targetType == typeof ( Guid ) || targetType == typeof ( Guid ? ) ? typeof ( string ) : targetType ;
199200 var values = right . Trim ( '[' , ']' ) . Split ( ',' ) . Select ( x => x . Trim ( ) ) . ToList ( ) ;
200201 var elementType = targetType . IsArray ? targetType . GetElementType ( ) : targetType ;
201202
@@ -300,8 +301,14 @@ private static Expression CreateRightExprFromType(Type leftExprType, string righ
300301
301302 if ( targetType == typeof ( Guid ) )
302303 {
303- var guidParseMethod = typeof ( Guid ) . GetMethod ( "Parse" , new [ ] { typeof ( string ) } ) ;
304- return Expression . Call ( guidParseMethod , Expression . Constant ( right , typeof ( string ) ) ) ;
304+ // if (comparisonOperator == ComparisonOperator.InOperator() ||
305+ // comparisonOperator == ComparisonOperator.NotInOperator())
306+ // {
307+ // var guidParseMethod = typeof(Guid).GetMethod("Parse", new[] { typeof(string) });
308+ // return Expression.Call(guidParseMethod, Expression.Constant(right, typeof(string)));
309+ // }
310+
311+ return Expression . Constant ( right , typeof ( string ) ) ;
305312 }
306313
307314 var convertedValue = conversionFunction ( right ) ;
@@ -393,6 +400,13 @@ private static Parser<Expression> ComparisonExprParser<T>(ParameterExpression pa
393400 {
394401 return Expression . Equal ( Expression . Constant ( true ) , Expression . Constant ( true ) ) ;
395402 }
403+
404+ if ( temp . leftExpr . Type == typeof ( Guid ) || temp . leftExpr . Type == typeof ( Guid ? ) )
405+ {
406+ var toStringMethod = typeof ( Guid ) . GetMethod ( "ToString" , Type . EmptyTypes ) ;
407+ var leftExpr = Expression . Call ( temp . leftExpr , toStringMethod ! ) ;
408+ return temp . op . GetExpression < T > ( leftExpr , CreateRightExpr ( temp . leftExpr , temp . right ) , config ? . DbContextType ) ;
409+ }
396410
397411 var rightExpr = CreateRightExpr ( temp . leftExpr , temp . right ) ;
398412 return temp . op . GetExpression < T > ( temp . leftExpr , rightExpr , config ? . DbContextType ) ;
0 commit comments