[後端] 修改transaction scope 問題
This commit is contained in:
parent
bf1133311d
commit
a7afe09ac1
@ -1199,8 +1199,8 @@ SET FOREIGN_KEY_CHECKS = 1;";
|
|||||||
//}
|
//}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
int count = 0;
|
||||||
#region 放入import_niagara_item資料表
|
#region 放入import_niagara_item資料表
|
||||||
foreach (var row in ds)
|
foreach (var row in ds)
|
||||||
{
|
{
|
||||||
@ -1221,6 +1221,16 @@ device_floor_tag, device_master_tag, device_last_name_tag, device_serial_tag, d
|
|||||||
row.isHistory + ", now() " +
|
row.isHistory + ", now() " +
|
||||||
");";
|
");";
|
||||||
sb.Append(ss);
|
sb.Append(ss);
|
||||||
|
count++;
|
||||||
|
if (count == 100)
|
||||||
|
{
|
||||||
|
using (TransactionScope scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
|
||||||
|
{
|
||||||
|
await conn.ExecuteAsync(sb.ToString());
|
||||||
|
}
|
||||||
|
sb.Clear();
|
||||||
|
count = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (sb.Length > 0)
|
if (sb.Length > 0)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user