I have list of rows for insert to database within a transaction using Asp.Net. But it will not commit fully. That means the last fews rows are only inserted.
我有使用Asp.Net在事务中插入数据库的行列表。但它不会完全承诺。这意味着只插入最后几行。
My code is:
我的代码是:
using (PetaPoco.Database db = new Database("Mydb"))
{
using (var trn = db.GetTransaction())
{
foreach(var r in rowlist)
{
db.Save(r);
}
trn.Complete();
}
}
For example rowlist has 20 elements, but some first elements are not inserted using Petapoco. But it will happen very rarely that means very slow network connection.
例如,rowlist有20个元素,但是没有使用Petapoco插入一些第一个元素。但它很少发生,这意味着网络连接速度非常慢。
1 个解决方案
#1
0
I don't think that the problem it's in the transaction or Petapoco.
我不认为它在交易或Petapoco中的问题。
Two guesses:
- Maybe the list is not posted in full due to slow connection?
- Are you aware that
db.Save
updates or insert depending on the object configuration and ID value? Maybe the last records are updated over the first one inserted
由于连接速度慢,列表可能没有完整发布?
您是否知道db.Save根据对象配置和ID值更新或插入?也许最后一条记录会在插入的第一条记录中更新
#1
0
I don't think that the problem it's in the transaction or Petapoco.
我不认为它在交易或Petapoco中的问题。
Two guesses:
- Maybe the list is not posted in full due to slow connection?
- Are you aware that
db.Save
updates or insert depending on the object configuration and ID value? Maybe the last records are updated over the first one inserted
由于连接速度慢,列表可能没有完整发布?
您是否知道db.Save根据对象配置和ID值更新或插入?也许最后一条记录会在插入的第一条记录中更新