Skip to content

Commit

Permalink
Merge pull request #1976 from zhjting1981/master
Browse files Browse the repository at this point in the history
JsonMap Deserialize surpport JsonSerializerSettings
  • Loading branch information
2881099 authored Feb 16, 2025
2 parents 7353bbf + 51ea553 commit f7b8d5f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Extensions/FreeSql.Extensions.JsonMap/JsonMapCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public static class FreeSqlJsonMapCoreExtensions
{
static int _isAoped = 0;
static ConcurrentDictionary<Type, bool> _dicTypes = new ConcurrentDictionary<Type, bool>();
static MethodInfo MethodJsonConvertDeserializeObject = typeof(JsonConvert).GetMethod("DeserializeObject", new[] { typeof(string), typeof(Type) });
static MethodInfo MethodJsonConvertDeserializeObject = typeof(JsonConvert).GetMethod("DeserializeObject", new[] { typeof(string), typeof(Type), typeof(JsonSerializerSettings) });
static MethodInfo MethodJsonConvertSerializeObject = typeof(JsonConvert).GetMethod("SerializeObject", new[] { typeof(object), typeof(JsonSerializerSettings) });
static ConcurrentDictionary<Type, ConcurrentDictionary<string, bool>> _dicJsonMapFluentApi = new ConcurrentDictionary<Type, ConcurrentDictionary<string, bool>>();
static object _concurrentObj = new object();
Expand Down Expand Up @@ -44,7 +44,7 @@ public static void UseJsonMap(this IFreeSql fsql, JsonSerializerSettings setting
if (_dicTypes.ContainsKey(type)) return Expression.IfThenElse(
Expression.TypeIs(valueExp, type),
Expression.Return(returnTarget, valueExp),
Expression.Return(returnTarget, Expression.TypeAs(Expression.Call(MethodJsonConvertDeserializeObject, Expression.Convert(valueExp, typeof(string)), Expression.Constant(type)), type))
Expression.Return(returnTarget, Expression.TypeAs(Expression.Call(MethodJsonConvertDeserializeObject, Expression.Convert(valueExp, typeof(string)), Expression.Constant(type),Expression.Constant(settings)), type))
);
return null;
});
Expand Down

0 comments on commit f7b8d5f

Please sign in to comment.