mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-10-15 18:55:07 +08:00
-
This commit is contained in:
@@ -84,7 +84,7 @@ namespace SqlSugar
|
||||
if (this.Context.MappingColumns == null || this.Context.MappingColumns.Count == 0) return entityPropertyName;
|
||||
else
|
||||
{
|
||||
var mappingInfo = this.Context.MappingColumns.SingleOrDefault(it => it.EntityName == typeName && it.EntityPropertyName == entityPropertyName);
|
||||
var mappingInfo = this.Context.MappingColumns.SingleOrDefault(it => it.EntityName == typeName && it.PropertyName == entityPropertyName);
|
||||
return mappingInfo == null ? entityPropertyName : mappingInfo.DbColumnName;
|
||||
}
|
||||
}
|
||||
|
@@ -161,7 +161,7 @@ namespace SqlSugar
|
||||
}
|
||||
else
|
||||
{
|
||||
var mappInfo = this.Context.MappingColumns.FirstOrDefault(it => it.EntityPropertyName.Equals(entityName, StringComparison.CurrentCultureIgnoreCase));
|
||||
var mappInfo = this.Context.MappingColumns.FirstOrDefault(it => it.PropertyName.Equals(entityName, StringComparison.CurrentCultureIgnoreCase));
|
||||
return mappInfo == null ? entityName : mappInfo.DbColumnName;
|
||||
}
|
||||
}
|
||||
|
@@ -192,7 +192,7 @@ namespace SqlSugar
|
||||
}
|
||||
else
|
||||
{
|
||||
var mappInfo = this.Context.MappingColumns.FirstOrDefault(it => it.EntityPropertyName.Equals(entityName, StringComparison.CurrentCultureIgnoreCase));
|
||||
var mappInfo = this.Context.MappingColumns.FirstOrDefault(it => it.PropertyName.Equals(entityName, StringComparison.CurrentCultureIgnoreCase));
|
||||
return mappInfo == null ? entityName : mappInfo.DbColumnName;
|
||||
}
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@ namespace SqlSugar
|
||||
{
|
||||
public class MappingColumn
|
||||
{
|
||||
public string EntityPropertyName { get; set; }
|
||||
public string PropertyName { get; set; }
|
||||
public string DbColumnName { get; set; }
|
||||
public string EntityName { get; set; }
|
||||
}
|
||||
|
@@ -41,8 +41,8 @@ namespace SqlSugar
|
||||
{
|
||||
public void Add(string propertyName, string dbColumnName, string entityName)
|
||||
{
|
||||
this.RemoveAll(it => it.EntityPropertyName.Equals(propertyName, StringComparison.CurrentCultureIgnoreCase));
|
||||
this.Add(new MappingColumn() { EntityPropertyName = propertyName, DbColumnName = dbColumnName, EntityName = entityName });
|
||||
this.RemoveAll(it => it.PropertyName.Equals(propertyName, StringComparison.CurrentCultureIgnoreCase));
|
||||
this.Add(new MappingColumn() { PropertyName = propertyName, DbColumnName = dbColumnName, EntityName = entityName });
|
||||
}
|
||||
public new void Clear()
|
||||
{
|
||||
|
@@ -114,7 +114,7 @@ namespace SqlSugar
|
||||
if (name.Contains("."))
|
||||
{
|
||||
var columnInfo = name.Split('.');
|
||||
var mappingInfo = this.MappingColumns.FirstOrDefault(it => it.EntityPropertyName.Equals(columnInfo.Last(), StringComparison.CurrentCultureIgnoreCase));
|
||||
var mappingInfo = this.MappingColumns.FirstOrDefault(it => it.PropertyName.Equals(columnInfo.Last(), StringComparison.CurrentCultureIgnoreCase));
|
||||
if (mappingInfo != null)
|
||||
{
|
||||
columnInfo[columnInfo.Length - 1] = mappingInfo.DbColumnName;
|
||||
@@ -123,7 +123,7 @@ namespace SqlSugar
|
||||
}
|
||||
else
|
||||
{
|
||||
var mappingInfo = this.MappingColumns.FirstOrDefault(it => it.EntityPropertyName.Equals(name, StringComparison.CurrentCultureIgnoreCase));
|
||||
var mappingInfo = this.MappingColumns.FirstOrDefault(it => it.PropertyName.Equals(name, StringComparison.CurrentCultureIgnoreCase));
|
||||
return "[" + (mappingInfo == null ? name : mappingInfo.DbColumnName) + "]";
|
||||
}
|
||||
}
|
||||
|
@@ -26,7 +26,7 @@ namespace SqlSugar
|
||||
.MappingColumns
|
||||
.FirstOrDefault(it =>
|
||||
it.EntityName.Equals(entityName, StringComparison.CurrentCultureIgnoreCase)&&
|
||||
it.EntityPropertyName.Equals(propertyName, StringComparison.CurrentCultureIgnoreCase));
|
||||
it.PropertyName.Equals(propertyName, StringComparison.CurrentCultureIgnoreCase));
|
||||
return (mappingInfo == null ? "["+ propertyName + "]" : "["+mappingInfo.DbColumnName+"]");
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user