Merge branch 'master' into master

This commit is contained in:
2881099
2020-03-21 19:27:39 +08:00
committed by GitHub
5 changed files with 69 additions and 23 deletions

View File

@ -15,7 +15,7 @@ namespace FreeSql.Extensions
static object _isAopedLock = new object();
static ConcurrentDictionary<Type, bool> _dicTypes = new ConcurrentDictionary<Type, bool>();
static MethodInfo MethodJsonConvertDeserializeObject = typeof(JsonConvert).GetMethod("DeserializeObject", new[] { typeof(string), typeof(Type) });
static MethodInfo MethodJsonConvertSerializeObject = typeof(JsonConvert).GetMethod("SerializeObject", new[] { typeof(object) });
static MethodInfo MethodJsonConvertSerializeObject = typeof(JsonConvert).GetMethod("SerializeObject", new[] { typeof(object), typeof(JsonSerializerSettings) });
/// <summary>
/// 当实体类属性为【对象】时,并且标记特性 [JsonMap] 时该属性将以JSON形式映射存储
@ -24,13 +24,13 @@ namespace FreeSql.Extensions
public static void UseJsonMap(this IFreeSql that)
{
UseJsonMap(that,new JsonSerializerSettings());
UseJsonMap(that, Newtonsoft.Json.JsonConvert.DefaultSettings?.Invoke() ?? new JsonSerializerSettings());
}
public static void UseJsonMap(this IFreeSql that, JsonSerializerSettings settings)
{
if (_isAoped == false)
lock(_isAopedLock)
lock (_isAopedLock)
if (_isAoped == false)
{
_isAoped = true;
@ -60,5 +60,6 @@ namespace FreeSql.Extensions
});
}
}
}
}