Wrapped the bulk insert inside a transaction

pull/470/head
tidusjar 8 years ago
parent 1fa32d29ea
commit 5471a77480

@ -289,9 +289,21 @@ namespace PlexRequests.Store.Repository
ResetCache();
using (var db = Config.DbConnection())
{
var result = enumerable.Sum(e => db.Insert(e));
db.Open();
using (var tran = db.BeginTransaction())
{
var result = enumerable.Sum(e => db.Insert(e));
var done = result == enumerable.Length;
return result == enumerable.Length;
if (done)
{
tran.Commit();
return true;
}
tran.Rollback();
return false;
}
}
}

Loading…
Cancel
Save