mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-20 02:29:39 +08:00
-
This commit is contained in:
@@ -76,7 +76,7 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
public string GetDbColumnName<T>(string propertyName)
|
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");
|
Check.Exception(!isAny, "Property " + propertyName + " is Invalid");
|
||||||
var typeName = typeof(T).Name;
|
var typeName = typeof(T).Name;
|
||||||
if (this.Context.MappingColumns == null || this.Context.MappingColumns.Count == 0) return propertyName;
|
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);
|
return typeof(T).GetProperties().First(it => it.Name == propertyName);
|
||||||
}
|
}
|
||||||
#region Primary key
|
#region Primary key
|
||||||
private static void SetColumns(EntityInfo result)
|
private void SetColumns(EntityInfo result)
|
||||||
{
|
{
|
||||||
foreach (var property in result.Type.GetProperties())
|
foreach (var property in result.Type.GetProperties())
|
||||||
{
|
{
|
||||||
@@ -141,6 +141,18 @@ namespace SqlSugar
|
|||||||
column.IsIgnore = true;
|
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);
|
result.Columns.Add(column);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user