Skip to content

Commit

Permalink
perf: optimize code
Browse files Browse the repository at this point in the history
  • Loading branch information
AElfBourneShi committed Oct 17, 2024
1 parent 779ae77 commit e8278ed
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -313,14 +313,10 @@ private void HandleNestedContains(SubQueryExpression subQueryExpression, Express
private Node GetDifferentTypesTermsQueryNode()
{
Node query;
if (PropertyType == typeof(Guid) || PropertyType == typeof(Guid))
if (PropertyType == typeof(Guid) || PropertyType == typeof(Guid?))
{
query = new TermsNode(PropertyName, ((IEnumerable<Guid>)Value).Select(x => x.ToString()));
}
else if (PropertyType == typeof(Guid?) || PropertyType == typeof(Guid?))
{
query = new TermsNode(PropertyName, ((IEnumerable<Guid?>)Value).Select(x => x?.ToString()));
}
else if (PropertyType == typeof(int) || PropertyType == typeof(int?))
{
query = new TermsNode(PropertyName, ((IEnumerable<int>)Value).Select(x => x.ToString()));
Expand All @@ -336,7 +332,7 @@ private Node GetDifferentTypesTermsQueryNode()
else if (PropertyType == typeof(DateTime) || PropertyType == typeof(DateTime?))
{
query = new TermsNode(PropertyName,
((IEnumerable<DateTime>)Value).Select(x => x.ToString("o"))); // ISO 8601 format
((IEnumerable<DateTime>)Value).Select(x => x.ToString()));
}
else if (PropertyType == typeof(bool) || PropertyType == typeof(bool?))
{
Expand Down

0 comments on commit e8278ed

Please sign in to comment.