mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-20 02:29:39 +08:00
Update unit test
This commit is contained in:
@@ -56,8 +56,38 @@ namespace OrmTest
|
|||||||
{
|
{
|
||||||
throw new Exception("unit Bulk");
|
throw new Exception("unit Bulk");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Db.CodeFirst.InitTables<UnitIdentity111>();
|
||||||
|
Db.DbMaintenance.TruncateTable<UnitIdentity111>();
|
||||||
|
var count=Db.Fastest<UnitIdentity111111111>().AS("UnitIdentity111").BulkCopy(new List<UnitIdentity111111111> {
|
||||||
|
new UnitIdentity111111111(){ Id=1, Name="jack" }
|
||||||
|
});
|
||||||
|
if (count == 0)
|
||||||
|
{
|
||||||
|
throw new Exception("unit Bulk");
|
||||||
|
}
|
||||||
|
count = Db.Fastest<UnitIdentity111111111>().AS("UnitIdentity111").BulkUpdate(new List<UnitIdentity111111111> {
|
||||||
|
new UnitIdentity111111111(){ Id=1, Name="jack" }
|
||||||
|
});
|
||||||
|
if (count == 0)
|
||||||
|
{
|
||||||
|
throw new Exception("unit Bulk");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class UnitIdentity111
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
}
|
||||||
|
public class UnitIdentity111111111
|
||||||
|
{
|
||||||
|
[SqlSugar.SugarColumn(IsPrimaryKey = true)]
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
public class UnitIdentity1
|
public class UnitIdentity1
|
||||||
{
|
{
|
||||||
[SqlSugar.SugarColumn(IsPrimaryKey =true,IsIdentity =true)]
|
[SqlSugar.SugarColumn(IsPrimaryKey =true,IsIdentity =true)]
|
||||||
|
@@ -80,6 +80,8 @@ namespace SqlSugar
|
|||||||
private async Task<int> _BulkUpdate(List<T> datas, string[] whereColumns, string[] updateColumns)
|
private async Task<int> _BulkUpdate(List<T> datas, string[] whereColumns, string[] updateColumns)
|
||||||
{
|
{
|
||||||
Begin(datas);
|
Begin(datas);
|
||||||
|
Check.Exception(whereColumns == null || whereColumns.Count() == 0, "where columns count=0");
|
||||||
|
Check.Exception(updateColumns == null || updateColumns.Count() == 0, "set columns count=0");
|
||||||
var isAuto = this.context.CurrentConnectionConfig.IsAutoCloseConnection;
|
var isAuto = this.context.CurrentConnectionConfig.IsAutoCloseConnection;
|
||||||
this.context.CurrentConnectionConfig.IsAutoCloseConnection = false;
|
this.context.CurrentConnectionConfig.IsAutoCloseConnection = false;
|
||||||
DataTable dt = ToDdateTable(datas);
|
DataTable dt = ToDdateTable(datas);
|
||||||
|
Reference in New Issue
Block a user