- 优化 pgsql + JsonMap 自动映射为 jsonb;#2060

This commit is contained in:
28810
2025-07-09 15:26:29 +08:00
parent 083166c3ef
commit 0a9c685511
2 changed files with 12 additions and 3 deletions

View File

@@ -2,6 +2,7 @@
using FreeSql.DataAnnotations;
using FreeSql.Internal.CommonProvider;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
@@ -62,8 +63,16 @@ public static class FreeSqlJsonMapCoreExtensions
if (e.ModifyResult.MapType == null)
{
e.ModifyResult.MapType = typeof(string);
e.ModifyResult.StringLength = -2;
switch (fsql.Ado.DataType)
{
case DataType.PostgreSQL:
e.ModifyResult.MapType = typeof(JObject);
break;
default:
e.ModifyResult.MapType = typeof(string);
e.ModifyResult.StringLength = -2;
break;
}
}
if (_dicTypes.TryAdd(e.Property.PropertyType, true))
{