@@ -54,8 +54,6 @@ public static Result<Expression> Evaluate(QueryExpression expression, ParameterE
5454 case DateLiteral literal :
5555 if ( property . Type == typeof ( DateTime ? ) )
5656 {
57- // For nullable DateTime, we need to handle this differently in the operator switch
58- // Just set up the date value for now
5957 value = Expression . Constant ( literal . Value . Date , typeof ( DateTime ) ) ;
6058 }
6159 else
@@ -134,30 +132,16 @@ public static Result<Expression> Evaluate(QueryExpression expression, ParameterE
134132 return null ;
135133 }
136134
137- /// <summary>
138- /// Creates special nullable property comparisons for types that need property transformation.
139- /// Returns null if no special handling is needed.
140- /// </summary>
141135 private static Expression CreateNullableComparison ( MemberExpression property , ConstantExpression value , QueryExpression rightExpression , string operatorKeyword )
142136 {
143- // Handle nullable DateTime with DateLiteral - requires .Date property access
144137 if ( property . Type == typeof ( DateTime ? ) && rightExpression is DateLiteral )
145138 {
146139 return CreateNullableDateComparison ( property , value , operatorKeyword ) ;
147140 }
148141
149- // Future extensibility: Add other type transformations here
150- // if (property.Type == typeof(TimeOnly?) && rightExpression is TimeLiteral)
151- // {
152- // return CreateNullableTimeComparison(property, value, operatorKeyword);
153- // }
154-
155142 return null ;
156143 }
157144
158- /// <summary>
159- /// Creates nullable DateTime comparisons that safely access the .Date property.
160- /// </summary>
161145 private static Expression CreateNullableDateComparison ( MemberExpression property , ConstantExpression value , string operatorKeyword )
162146 {
163147 var hasValueProperty = Expression . Property ( property , "HasValue" ) ;
@@ -175,8 +159,6 @@ private static Expression CreateNullableDateComparison(MemberExpression property
175159 _ => throw new ArgumentException ( $ "Unsupported operator for nullable date comparison: { operatorKeyword } ")
176160 } ;
177161
178- // For inequality, we want: !HasValue OR HasValue && comparison != true
179- // For others, we want: HasValue && comparison == true
180162 return operatorKeyword == Keywords . Ne
181163 ? Expression . OrElse ( Expression . Not ( hasValueProperty ) , dateComparison )
182164 : Expression . AndAlso ( hasValueProperty , dateComparison ) ;
0 commit comments