修复字段null时order by错误

This commit is contained in:
alex-310 2023-08-23 13:12:51 +08:00 committed by GitHub
parent 1342d13eb3
commit 0b525ce9f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -106,6 +106,10 @@ namespace ShardingCore.Sharding.Enumerators
{ {
list.Add((IComparable)value); list.Add((IComparable)value);
} }
else if (value == null) // Support Nullable<xx>
{
list.Add(null);
}
else else
{ {
throw new NotSupportedException($"order by value [{order}] must implements IComparable"); throw new NotSupportedException($"order by value [{order}] must implements IComparable");
@ -142,4 +146,4 @@ namespace ShardingCore.Sharding.Enumerators
#endif #endif
} }
} }