Bug fix #250 : recent refactor introduced a race condition for db creation on initial install. Moved db creation to before all other init/config is called

This commit is contained in:
Robert McRackan 2022-05-18 08:13:18 -04:00
parent 72e667e825
commit 051fa0a28f
2 changed files with 5 additions and 1 deletions

View File

@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<Version>7.6.0.1</Version>
<Version>7.6.1.1</Version>
</PropertyGroup>
<ItemGroup>

View File

@ -30,6 +30,10 @@ namespace LibationWinForms
gridPanel.Controls.Add(productsGrid);
}
// Pre-requisite:
// Before calling anything else, including subscribing to events, ensure database exists. If we wait and let it happen lazily, race conditions and errors are likely during new installs
using var _ = DbContexts.GetContext();
this.Load += (_, _) => this.RestoreSizeAndLocation(Configuration.Instance);
this.FormClosing += (_, _) => this.SaveSizeAndLocation(Configuration.Instance);