mirror of
https://github.com/Sonarr/Sonarr
synced 2026-05-08 13:01:10 +02:00
Wrap bulk UpdateMany/SetFields in a transaction
This commit is contained in:
parent
6214803a5a
commit
d8b16d7926
1 changed files with 6 additions and 2 deletions
|
|
@ -266,8 +266,10 @@ public void UpdateMany(IList<TModel> models)
|
|||
}
|
||||
|
||||
using (var conn = _database.OpenConnection())
|
||||
using (var tran = conn.BeginTransaction(IsolationLevel.ReadCommitted))
|
||||
{
|
||||
UpdateFields(conn, null, models, _properties);
|
||||
UpdateFields(conn, tran, models, _properties);
|
||||
tran.Commit();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -371,8 +373,10 @@ public void SetFields(IList<TModel> models, params Expression<Func<TModel, objec
|
|||
var propertiesToUpdate = properties.Select(x => x.GetMemberName()).ToList();
|
||||
|
||||
using (var conn = _database.OpenConnection())
|
||||
using (var tran = conn.BeginTransaction(IsolationLevel.ReadCommitted))
|
||||
{
|
||||
UpdateFields(conn, null, models, propertiesToUpdate);
|
||||
UpdateFields(conn, tran, models, propertiesToUpdate);
|
||||
tran.Commit();
|
||||
}
|
||||
|
||||
foreach (var model in models)
|
||||
|
|
|
|||
Loading…
Reference in a new issue