mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-20 02:29:39 +08:00
Update EntityMain
This commit is contained in:
@@ -128,6 +128,14 @@ namespace SqlSugar
|
|||||||
return mappingInfo == null ? tableName : mappingInfo.EntityName;
|
return mappingInfo == null ? tableName : mappingInfo.EntityName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public string GetEntityName<T>()
|
||||||
|
{
|
||||||
|
return this.Context.EntityMaintenance.GetEntityInfo<T>().EntityName;
|
||||||
|
}
|
||||||
|
public string GetEntityName(Type type)
|
||||||
|
{
|
||||||
|
return this.Context.EntityMaintenance.GetEntityInfo(type).EntityName;
|
||||||
|
}
|
||||||
public string GetDbColumnName<T>(string propertyName)
|
public string GetDbColumnName<T>(string propertyName)
|
||||||
{
|
{
|
||||||
return GetDbColumnName(propertyName, typeof(T));
|
return GetDbColumnName(propertyName, typeof(T));
|
||||||
@@ -151,6 +159,11 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
public string GetPropertyName<T>(string dbColumnName)
|
public string GetPropertyName<T>(string dbColumnName)
|
||||||
{
|
{
|
||||||
|
var columnInfo=this.Context.EntityMaintenance.GetEntityInfo<T>().Columns.FirstOrDefault(it=>it.DbColumnName.EqualCase(dbColumnName));
|
||||||
|
if (columnInfo != null)
|
||||||
|
{
|
||||||
|
return columnInfo.PropertyName;
|
||||||
|
}
|
||||||
var typeName = typeof(T).Name;
|
var typeName = typeof(T).Name;
|
||||||
if (this.Context.MappingColumns == null || this.Context.MappingColumns.Count == 0) return dbColumnName;
|
if (this.Context.MappingColumns == null || this.Context.MappingColumns.Count == 0) return dbColumnName;
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user