Skip to content

Commit

Permalink
feat: optimize property type nullable
Browse files Browse the repository at this point in the history
  • Loading branch information
AElfBourneShi committed Oct 17, 2024
1 parent e8278ed commit 9d339a4
Showing 1 changed file with 31 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -313,31 +313,56 @@ private void HandleNestedContains(SubQueryExpression subQueryExpression, Express
private Node GetDifferentTypesTermsQueryNode()
{
Node query;
if (PropertyType == typeof(Guid) || PropertyType == typeof(Guid?))
if (PropertyType == typeof(Guid))
{
query = new TermsNode(PropertyName, ((IEnumerable<Guid>)Value).Select(x => x.ToString()));
}
else if (PropertyType == typeof(int) || PropertyType == typeof(int?))
else if (PropertyType == typeof(Guid?))
{
query = new TermsNode(PropertyName, ((IEnumerable<Guid?>)Value).Select(x => x.ToString()));
}
else if (PropertyType == typeof(int))
{
query = new TermsNode(PropertyName, ((IEnumerable<int>)Value).Select(x => x.ToString()));
}
else if (PropertyType == typeof(long) || PropertyType == typeof(long?))
else if (PropertyType == typeof(int?))
{
query = new TermsNode(PropertyName, ((IEnumerable<int?>)Value).Select(x => x.ToString()));
}
else if (PropertyType == typeof(long))
{
query = new TermsNode(PropertyName, ((IEnumerable<long>)Value).Select(x => x.ToString()));
}
else if (PropertyType == typeof(double) || PropertyType == typeof(double?))
else if (PropertyType == typeof(long?))
{
query = new TermsNode(PropertyName, ((IEnumerable<long?>)Value).Select(x => x.ToString()));
}
else if (PropertyType == typeof(double))
{
query = new TermsNode(PropertyName, ((IEnumerable<double>)Value).Select(x => x.ToString()));
}
else if (PropertyType == typeof(DateTime) || PropertyType == typeof(DateTime?))
else if(PropertyType == typeof(double?))
{
query = new TermsNode(PropertyName, ((IEnumerable<double?>)Value).Select(x => x.ToString()));
}
else if (PropertyType == typeof(DateTime))
{
query = new TermsNode(PropertyName,
((IEnumerable<DateTime>)Value).Select(x => x.ToString()));
}
else if (PropertyType == typeof(bool) || PropertyType == typeof(bool?))
else if (PropertyType == typeof(DateTime?))
{
query = new TermsNode(PropertyName,
((IEnumerable<DateTime?>)Value).Select(x => x.ToString()));
}
else if (PropertyType == typeof(bool))
{
query = new TermsNode(PropertyName, ((IEnumerable<bool>)Value).Select(x => x.ToString()));
}
else if (PropertyType == typeof(bool?))
{
query = new TermsNode(PropertyName, ((IEnumerable<bool?>)Value).Select(x => x.ToString()));
}
else if (PropertyType == typeof(string))
{
query = new TermsNode(PropertyName, (IEnumerable<string>)Value);
Expand Down

0 comments on commit 9d339a4

Please sign in to comment.