mirror of
				https://github.com/nsnail/FreeSql.git
				synced 2025-11-04 17:20:49 +08:00 
			
		
		
		
	- 完善 [Column(MapType = typeof(byte[]))] 对 Guid/string 的映射支持;
This commit is contained in:
		@@ -156,15 +156,8 @@ namespace FreeSql.PostgreSQL
 | 
			
		||||
            }
 | 
			
		||||
            value = getParamterValue(type, value);
 | 
			
		||||
            var type2 = value.GetType();
 | 
			
		||||
            if (type2 == typeof(byte[]))
 | 
			
		||||
            {
 | 
			
		||||
                var bytes = value as byte[];
 | 
			
		||||
                var sb = new StringBuilder().Append("'\\x");
 | 
			
		||||
                foreach (var vc in bytes)
 | 
			
		||||
                    sb.Append(vc.ToString("X").PadLeft(2, '0'));
 | 
			
		||||
                return sb.Append("'").ToString(); //val = Encoding.UTF8.GetString(val as byte[]);
 | 
			
		||||
            }
 | 
			
		||||
            else if (type2 == typeof(TimeSpan) || type2 == typeof(TimeSpan?))
 | 
			
		||||
            if (type2 == typeof(byte[])) return $"'\\x{CommonUtils.BytesSqlRaw(value as byte[])}'";
 | 
			
		||||
            if (type2 == typeof(TimeSpan) || type2 == typeof(TimeSpan?))
 | 
			
		||||
            {
 | 
			
		||||
                var ts = (TimeSpan)value;
 | 
			
		||||
                return $"'{Math.Min(24, (int)Math.Floor(ts.TotalHours))}:{ts.Minutes}:{ts.Seconds}'";
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user