BaseDataWindow: Remove transactions inside *Save() functions to avoid nesting them
This commit is contained in:
@@ -41,7 +41,6 @@ namespace Elwig.Windows {
|
||||
if (!_cultChanged || _cultList == null || _cults == null || _cultIds == null)
|
||||
return;
|
||||
|
||||
using var tx = await ctx.Database.BeginTransactionAsync();
|
||||
var deleteCultIds = _cults.Where(c => c.Value == null).Select(c => c.Key).ToList();
|
||||
await ctx.WineCultivations.Where(c => deleteCultIds.Contains(c.CultId)).ExecuteDeleteAsync();
|
||||
foreach (var (cult, old) in _cultIds) {
|
||||
@@ -62,7 +61,6 @@ namespace Elwig.Windows {
|
||||
ctx.Add(cult);
|
||||
}
|
||||
await ctx.SaveChangesAsync();
|
||||
await tx.CommitAsync();
|
||||
}
|
||||
|
||||
private void WineCultivationList_SelectionChanged(object? sender, SelectionChangedEventArgs? evt) {
|
||||
|
||||
Reference in New Issue
Block a user