Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion QueryExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,12 @@ private static Expression GetSearchValue(object? searchValue, Type targetType)
}

var jsonVal = JsonValue.Create(searchValue);

if (string.IsNullOrWhiteSpace(jsonVal?.ToString()) && targetType != typeof(string))
{
return GetEmptyValue(targetType);
}

var valueKind = jsonVal?.GetValueKind();
if (valueKind == null || valueKind == JsonValueKind.Null || valueKind == JsonValueKind.Undefined)
{
Expand Down Expand Up @@ -293,7 +299,7 @@ private static Expression GetSearchValue(object? searchValue, Type targetType)
}
}

var value = jsonVal.Deserialize(targetType);
var value = jsonVal.Deserialize(targetType, new JsonSerializerOptions { NumberHandling = JsonNumberHandling.AllowReadingFromString });

var convertedValue = Convert.ChangeType(value, nonNullableType, CultureInfo.InvariantCulture);
return Expression.Constant(convertedValue, targetType);
Expand Down
Loading