This commit is contained in:
sunkaixuan
2017-10-21 16:06:12 +08:00
parent a2812eae8a
commit 36adba37ae

View File

@@ -102,7 +102,7 @@ namespace SqlSugar
return typeof(T).GetProperties().First(it => it.Name == propertyName);
}
#region Primary key
private static void SetColumns(EntityInfo result)
private void SetColumns(EntityInfo result)
{
foreach (var property in result.Type.GetProperties())
{
@@ -141,6 +141,18 @@ namespace SqlSugar
column.IsIgnore = true;
}
}
if (this.Context.MappingColumns.HasValue())
{
var golbalMappingInfo = this.Context.MappingColumns.FirstOrDefault(it => it.EntityName.Equals(result.EntityName, StringComparison.CurrentCultureIgnoreCase) && it.PropertyName == column.PropertyName);
if (golbalMappingInfo != null)
column.DbColumnName = golbalMappingInfo.DbColumnName;
}
if (this.Context.IgnoreColumns.HasValue())
{
var golbalMappingInfo = this.Context.IgnoreColumns.FirstOrDefault(it => it.EntityName.Equals(result.EntityName, StringComparison.CurrentCultureIgnoreCase) && it.PropertyName == column.PropertyName);
if (golbalMappingInfo != null)
column.IsIgnore = true;
}
result.Columns.Add(column);
}
}