BaseDataWindow: Remove transactions inside *Save() functions to avoid nesting them
This commit is contained in:
@@ -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