Browse Source

Synchronization code

pull/33/head
sunkaixuan 2 years ago
parent
commit
a9f1a6883d
  1. 2
      Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableExecuteSql.cs
  2. 2
      Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableExecuteSqlAsync.cs
  3. 8
      Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableHelper.cs

2
Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableExecuteSql.cs

@ -760,7 +760,7 @@ namespace SqlSugar
{
KeyValuePair<string, List<SugarParameter>> sqlInfo;
string sql;
OutIntoTableSql(TableName, out sqlInfo, out sql);
OutIntoTableSql(TableName, out sqlInfo, out sql, TableEntityType);
return this.Context.Ado.ExecuteCommand(sql, sqlInfo.Value);
}
}

2
Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableExecuteSqlAsync.cs

@ -694,7 +694,7 @@ ParameterT parameter)
{
KeyValuePair<string, List<SugarParameter>> sqlInfo;
string sql;
OutIntoTableSql(TableName, out sqlInfo, out sql);
OutIntoTableSql(TableName, out sqlInfo, out sql,TableEntityType);
return await this.Context.Ado.ExecuteCommandAsync(sql, sqlInfo.Value);
}
}

8
Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableHelper.cs

@ -1188,8 +1188,9 @@ namespace SqlSugar
#region Other
private void OutIntoTableSql(string TableName, out KeyValuePair<string, List<SugarParameter>> sqlInfo, out string sql)
private void OutIntoTableSql(string TableName, out KeyValuePair<string, List<SugarParameter>> sqlInfo, out string sql,Type tableInfo)
{
var columnList = this.Context.EntityMaintenance.GetEntityInfo(tableInfo).Columns;
//var entityInfo = this.Context.EntityMaintenance.GetEntityInfo(TableEntityType);
sqlInfo = this.ToSql();
var name = this.SqlBuilder.GetTranslationTableName(TableName);
@ -1202,6 +1203,11 @@ namespace SqlSugar
foreach (var item in ExpressionTool.GetNewExpressionItemList((Expression)this.QueryBuilder.SelectValue))
{
var column = item.Key;
var columnInfo = columnList.FirstOrDefault(it => it.PropertyName == item.Key);
if (columnInfo != null)
{
column =this.SqlBuilder.GetTranslationColumnName(columnInfo.DbColumnName);
}
columns += $"{column},";
}
columns = columns.TrimEnd(',') + ")";

Loading…
Cancel
Save