BaseDataWindow: Remove transactions inside *Save() functions to avoid nesting them
This commit is contained in:
1 parent
15de07a4c3
commit
1261be001c
3 files changed
-6
No files matched your search
@@ -41,7 +41,6 @@ namespace Elwig.Windows {
|
||||
if (!_attrChanged || _attrList == null || _attrs == null || _attrIds == null)
|
||||
return;
|
||||
|
||||
using var tx = await ctx.Database.BeginTransactionAsync();
|
||||
var deleteAttrIds = _attrs.Where(a => a.Value == null).Select(a => a.Key).ToList();
|
||||
await ctx.WineAttributes.Where(a => deleteAttrIds.Contains(a.AttrId)).ExecuteDeleteAsync();
|
||||
foreach (var (attr, old) in _attrIds) {
|
||||
@@ -63,7 +62,6 @@ namespace Elwig.Windows {
|
||||
ctx.Add(attr);
|
||||
}
|
||||
await ctx.SaveChangesAsync();
|
||||
await tx.CommitAsync();
|
||||
}
|
||||
|
||||
private void WineAttributeList_SelectionChanged(object? sender, SelectionChangedEventArgs? evt) {
|
||||
|
||||
Reference in new issue
Block a user