diff --git a/NewLife.Redis/RedisEncoder.cs b/NewLife.Redis/RedisEncoder.cs index 9aaa6cb..b95f955 100644 --- a/NewLife.Redis/RedisEncoder.cs +++ b/NewLife.Redis/RedisEncoder.cs @@ -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) {