@@ -607,6 +607,18 @@ private static bool IsValidPropertyName(string value)
607607 value . All ( c => char . IsLetterOrDigit ( c ) || c == '_' || c == '.' ) ;
608608 }
609609
610+ private static CaseInsensitiveMode ResolveCaseMode ( string ? propertyPath , IQueryKitConfiguration ? config )
611+ {
612+ if ( ! string . IsNullOrEmpty ( propertyPath ) && config ? . PropertyMappings != null )
613+ {
614+ var propertyInfo = config . PropertyMappings . GetPropertyInfo ( propertyPath )
615+ ?? config . PropertyMappings . GetPropertyInfoByQueryName ( propertyPath ) ;
616+ if ( propertyInfo ? . CaseInsensitiveComparison . HasValue == true )
617+ return propertyInfo . CaseInsensitiveComparison . Value ;
618+ }
619+ return config ? . CaseInsensitiveComparison ?? CaseInsensitiveMode . Lower ;
620+ }
621+
610622 private static Parser < Expression > ComparisonExprParser < T > ( ParameterExpression parameter , IQueryKitConfiguration ? config )
611623 {
612624 var comparisonOperatorParser = ComparisonOperatorParser . Token ( ) ;
@@ -661,7 +673,7 @@ private static Parser<Expression> ComparisonExprParser<T>(ParameterExpression pa
661673 {
662674 var guidStringExpr = HandleGuidConversion ( temp . leftExpr , temp . leftExpr . Type ) ;
663675 return temp . op . GetExpression < T > ( guidStringExpr , CreateRightExpr ( temp . leftExpr , temp . right , temp . op , config , guidPropertyPath ) ,
664- config ? . DbContextType ) ;
676+ config ? . DbContextType , ResolveCaseMode ( guidPropertyPath , config ) ) ;
665677 }
666678
667679 // For non-string operators, use direct GUID comparison
@@ -692,7 +704,8 @@ private static Parser<Expression> ComparisonExprParser<T>(ParameterExpression pa
692704
693705 // Ensure compatible types for property-to-property comparison
694706 var ( leftCompatible , rightCompatible ) = EnsureCompatibleTypes ( leftExpr , rightPropertyExpr ) ;
695- return temp . op . GetExpression < T > ( leftCompatible , rightCompatible , config ? . DbContextType ) ;
707+ var propToProptPath = temp . leftExpr is MemberExpression ptpMemberExpr ? GetPropertyPath ( ptpMemberExpr , parameter ) : null ;
708+ return temp . op . GetExpression < T > ( leftCompatible , rightCompatible , config ? . DbContextType , ResolveCaseMode ( propToProptPath , config ) ) ;
696709 }
697710 }
698711
@@ -782,7 +795,7 @@ private static Parser<Expression> ComparisonExprParser<T>(ParameterExpression pa
782795 }
783796
784797
785- return temp . op . GetExpression < T > ( leftExprForComparison , rightExpr , config ? . DbContextType ) ;
798+ return temp . op . GetExpression < T > ( leftExprForComparison , rightExpr , config ? . DbContextType , ResolveCaseMode ( propertyPath , config ) ) ;
786799 } ) ;
787800
788801 return propertyListComparison . Or ( arithmeticComparison ) . Or ( regularComparison ) ;
@@ -1134,7 +1147,7 @@ private static Parser<Expression> PropertyListComparisonExprParser<T>(
11341147 }
11351148
11361149 var rightExpr = CreateRightExpr ( leftExpr , temp . right , temp . op , config , fullPropPath ) ;
1137- var comparison = temp . op . GetExpression < T > ( leftExpr , rightExpr , config ? . DbContextType ) ;
1150+ var comparison = temp . op . GetExpression < T > ( leftExpr , rightExpr , config ? . DbContextType , ResolveCaseMode ( fullPropPath , config ) ) ;
11381151
11391152 // Combine with AND for negative operators, OR for positive operators
11401153 result = result == null
0 commit comments