- 增加 [Description] 元数据注释,优先级低于 c# 代码注释;

This commit is contained in:
28810
2020-05-07 11:00:55 +08:00
parent ae11f552fa
commit 60bb29b19f
8 changed files with 88 additions and 2 deletions

View File

@ -69,7 +69,10 @@ namespace FreeSql.Internal
var propsLazy = new List<NaviteTuple<PropertyInfo, bool, bool, MethodInfo, MethodInfo>>();
var propsNavObjs = new List<PropertyInfo>();
var propsComment = CommonUtils.GetProperyCommentBySummary(entity);
var propsCommentByDescAttr = CommonUtils.GetPropertyCommentByDescriptionAttribute(entity);
trytb.Comment = propsComment != null && propsComment.TryGetValue("", out var tbcomment) ? tbcomment : "";
if (string.IsNullOrEmpty(trytb.Comment) && propsCommentByDescAttr != null && propsCommentByDescAttr.TryGetValue("", out tbcomment)) trytb.Comment = tbcomment;
var columnsList = new List<ColumnInfo>();
foreach (var p in trytb.Properties.Values)
{
@ -148,6 +151,9 @@ namespace FreeSql.Internal
};
if (propsComment != null && propsComment.TryGetValue(p.Name, out var trycomment))
col.Comment = trycomment;
if (string.IsNullOrEmpty(col.Comment) && propsCommentByDescAttr != null && propsCommentByDescAttr.TryGetValue(p.Name, out trycomment))
col.Comment = trycomment;
if (colattr.IsIgnore)
{
trytb.ColumnsByCsIgnore.Add(p.Name, col);