Add English comments for JsonMap extension package.

This commit is contained in:
AlexLEWIS 2021-08-11 13:38:06 +08:00
parent a5b5af4024
commit 39ac2d8286
2 changed files with 10 additions and 13 deletions

View File

@ -1,13 +1,11 @@
using System; using System;
using System.Linq;
// ReSharper disable once CheckNamespace
namespace FreeSql.DataAnnotations namespace FreeSql.DataAnnotations
{ {
/// <summary> /// <summary>
/// 当实体类属性为【对象】时以JSON形式映射存储 /// When the entity class property is <see cref="object"/>, map storage in JSON format. <br />
/// 当实体类属性为【对象】时,以 JSON 形式映射存储
/// </summary> /// </summary>
public class JsonMapAttribute : Attribute public class JsonMapAttribute : Attribute { }
{
}
} }

View File

@ -5,7 +5,6 @@ using System.Collections.Concurrent;
using System.Linq; using System.Linq;
using System.Linq.Expressions; using System.Linq.Expressions;
using System.Reflection; using System.Reflection;
using System.Text;
using System.Threading; using System.Threading;
public static class FreeSqlJsonMapCoreExtensions public static class FreeSqlJsonMapCoreExtensions
@ -19,11 +18,12 @@ public static class FreeSqlJsonMapCoreExtensions
public static ColumnFluent JsonMap(this ColumnFluent col) public static ColumnFluent JsonMap(this ColumnFluent col)
{ {
_dicJsonMapFluentApi.GetOrAdd(col._entityType, et => new ConcurrentDictionary<string, bool>()) _dicJsonMapFluentApi.GetOrAdd(col._entityType, et => new ConcurrentDictionary<string, bool>())
.GetOrAdd(col._property.Name, pn => true); .GetOrAdd(col._property.Name, pn => true);
return col; return col;
} }
/// <summary> /// <summary>
/// When the entity class property is <see cref="object"/> and the attribute is marked as <see cref="JsonMapAttribute"/>, map storage in JSON format. <br />
/// 当实体类属性为【对象】时,并且标记特性 [JsonMap] 时该属性将以JSON形式映射存储 /// 当实体类属性为【对象】时,并且标记特性 [JsonMap] 时该属性将以JSON形式映射存储
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
@ -43,7 +43,7 @@ public static class FreeSqlJsonMapCoreExtensions
}); });
} }
that.Aop.ConfigEntityProperty += new EventHandler<FreeSql.Aop.ConfigEntityPropertyEventArgs>((s, e) => that.Aop.ConfigEntityProperty += (s, e) =>
{ {
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)
@ -61,7 +61,6 @@ public static class FreeSqlJsonMapCoreExtensions
}); });
} }
} }
}); };
} }
} }