mirror of
https://github.com/dotnetcore/FreeSql.git
synced 2026-03-07 06:30:57 +08:00
- 优化 pgsql + JsonMap 自动映射为 jsonb;#2060
This commit is contained in:
@@ -3498,7 +3498,7 @@ class Table11
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[JsonMap, Column(DbType = "json")]
|
||||
[JsonMap]
|
||||
public TableOptions Options { get; set; }
|
||||
}
|
||||
class TableOptions
|
||||
|
||||
@@ -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))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user