mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-19 10:08:19 +08:00
-
This commit is contained in:
@@ -76,7 +76,7 @@ namespace SqlSugar
|
||||
}
|
||||
public string GetDbColumnName<T>(string propertyName)
|
||||
{
|
||||
var isAny=this.GetEntityInfo<T>().Columns.Any(it => it.PropertyName.Equals(propertyName, StringComparison.CurrentCultureIgnoreCase));
|
||||
var isAny = this.GetEntityInfo<T>().Columns.Any(it => it.PropertyName.Equals(propertyName, StringComparison.CurrentCultureIgnoreCase));
|
||||
Check.Exception(!isAny, "Property " + propertyName + " is Invalid");
|
||||
var typeName = typeof(T).Name;
|
||||
if (this.Context.MappingColumns == null || this.Context.MappingColumns.Count == 0) return propertyName;
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user