- 优化 JsonMap 对基础类型的无效判断;#1385

This commit is contained in:
2881099 2022-12-29 16:23:21 +08:00
parent 7a64f9d65f
commit 1613307f26

View File

@ -53,6 +53,9 @@ public static class FreeSqlJsonMapCoreExtensions
var isJsonMap = e.Property.GetCustomAttributes(typeof(JsonMapAttribute), false).Any() || _dicJsonMapFluentApi.TryGetValue(e.EntityType, out var tryjmfu) && tryjmfu.ContainsKey(e.Property.Name); var isJsonMap = e.Property.GetCustomAttributes(typeof(JsonMapAttribute), false).Any() || _dicJsonMapFluentApi.TryGetValue(e.EntityType, out var tryjmfu) && tryjmfu.ContainsKey(e.Property.Name);
if (isJsonMap) if (isJsonMap)
{ {
if (FreeSql.Internal.Utils.dicExecuteArrayRowReadClassOrTuple.ContainsKey(e.Property.PropertyType))
return; //基础类型使用 JsonMap 无效
e.ModifyResult.MapType = typeof(string); e.ModifyResult.MapType = typeof(string);
e.ModifyResult.StringLength = -2; e.ModifyResult.StringLength = -2;
if (_dicTypes.TryAdd(e.Property.PropertyType, true)) if (_dicTypes.TryAdd(e.Property.PropertyType, true))