Skip to content

Commit

Permalink
[fix]解码Redis响应数据时,支持可空类型
Browse files Browse the repository at this point in the history
  • Loading branch information
nnhy committed Apr 19, 2024
1 parent ca27efa commit 720da82
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions NewLife.Redis/RedisEncoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ public virtual Packet Encode(Object value)
//var str = pk.ToStr().Trim('\"');
var str = pk.ToStr();
if (type.GetTypeCode() == TypeCode.String) return str;

// 支持可空类型
type = Nullable.GetUnderlyingType(type) ?? type;
//if (type.GetTypeCode() != TypeCode.Object) return str.ChangeType(type);
if (type.GetTypeCode() != TypeCode.Object)
{
Expand Down

0 comments on commit 720da82

Please sign in to comment.