mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-24 18:04:52 +08:00
Unit test
This commit is contained in:
parent
56b8cffb46
commit
5a6fb11531
@ -73,9 +73,19 @@ namespace OrmTest
|
||||
{
|
||||
throw new Exception("unit Bulk");
|
||||
}
|
||||
Db.CodeFirst.InitTables<UnitTable001>();
|
||||
Db.Fastest<UnitTable001>().BulkUpdate(new List<UnitTable001> {
|
||||
new UnitTable001(){ Id=1, table="a" }
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class UnitTable001
|
||||
{
|
||||
[SqlSugar.SugarColumn(IsPrimaryKey =true)]
|
||||
public int Id { get; set; }
|
||||
public string table { get; set; }
|
||||
}
|
||||
public class UnitIdentity111
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
@ -27,10 +27,11 @@ namespace SqlSugar
|
||||
|
||||
public virtual async Task<int> UpdateByTempAsync(string tableName, string tempName, string[] updateColumns, string[] whereColumns)
|
||||
{
|
||||
var sqlbuilder = this.Context.Queryable<object>().SqlBuilder;
|
||||
Check.ArgumentNullException(!updateColumns.Any(), "update columns count is 0");
|
||||
Check.ArgumentNullException(!whereColumns.Any(), "where columns count is 0");
|
||||
var sets = string.Join(",", updateColumns.Select(it => $"TM.{it}=TE.{it}"));
|
||||
var wheres = string.Join(",", whereColumns.Select(it => $"TM.{it}=TE.{it}"));
|
||||
var sets = string.Join(",", updateColumns.Select(it => $"TM.{sqlbuilder.GetTranslationColumnName(it)}=TE.{sqlbuilder.GetTranslationColumnName(it)}"));
|
||||
var wheres = string.Join(",", whereColumns.Select(it => $"TM.{sqlbuilder.GetTranslationColumnName(it)}=TE.{sqlbuilder.GetTranslationColumnName(it)}"));
|
||||
string sql = string.Format(UpdateSql, sets, tableName, tempName, wheres);
|
||||
return await this.Context.Ado.ExecuteCommandAsync(sql);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user