diff --git a/WGneu/Helpers/WgContext.cs b/WGneu/Helpers/AppDbContext.cs similarity index 96% rename from WGneu/Helpers/WgContext.cs rename to WGneu/Helpers/AppDbContext.cs index 9373050..bf1fe9e 100644 --- a/WGneu/Helpers/WgContext.cs +++ b/WGneu/Helpers/AppDbContext.cs @@ -2,7 +2,7 @@ using WGneu.Models; namespace WGneu.Helpers { - public class WgContext : DbContext { + public class AppDbContext : DbContext { public DbSet Countries { get; set; } public DbSet Members { get; set; } public DbSet Gemeinden { get; set; } @@ -20,7 +20,6 @@ namespace WGneu.Helpers { public DbSet WineQualities { get; set; } public DbSet WineVarieties { get; set; } - protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { optionsBuilder.UseSqlite("Data Source=\"C:\\Users\\lorenz\\Desktop\\wgtest.sqlite3\"; foreign keys=true"); optionsBuilder.UseLazyLoadingProxies(); diff --git a/WGneu/Models/AT_Plz.cs b/WGneu/Models/AT_Plz.cs index 434b828..ce7407e 100644 --- a/WGneu/Models/AT_Plz.cs +++ b/WGneu/Models/AT_Plz.cs @@ -32,7 +32,7 @@ namespace WGneu.Models { [ForeignKey("CountryCode")] public virtual Country Country { get; set; } - public ISet Orte(WgContext ctx) { + public ISet Orte(AppDbContext ctx) { return ctx.Postleitzahlen.Where(p => p.Plz == Plz).ToHashSet(); } } diff --git a/WGneu/Models/PostalDest.cs b/WGneu/Models/PostalDest.cs index 69a4ad1..611651c 100644 --- a/WGneu/Models/PostalDest.cs +++ b/WGneu/Models/PostalDest.cs @@ -19,7 +19,7 @@ namespace WGneu.Models { [ForeignKey("CountryCode")] public virtual Country Country { get; set; } - public AT_Plz? Plz(WgContext ctx) { + public AT_Plz? Plz(AppDbContext ctx) { // TODO getter if (CountryCode != "AT") return null; return ctx.Postleitzahlen.Where(p => p.Id == Id).FirstOrDefault(); diff --git a/WGneu/Windows/ContractListWindow.xaml.cs b/WGneu/Windows/ContractListWindow.xaml.cs index b0a266b..884b246 100644 --- a/WGneu/Windows/ContractListWindow.xaml.cs +++ b/WGneu/Windows/ContractListWindow.xaml.cs @@ -8,7 +8,7 @@ using WGneu.Models; namespace WGneu.Windows { public partial class ContractListWindow : Window { - private readonly WgContext Context = new(); + private readonly AppDbContext Context = new(); public ContractListWindow(Member member) { InitializeComponent(); diff --git a/WGneu/Windows/MainWindow.xaml.cs b/WGneu/Windows/MainWindow.xaml.cs index 37769da..e353cd5 100644 --- a/WGneu/Windows/MainWindow.xaml.cs +++ b/WGneu/Windows/MainWindow.xaml.cs @@ -12,7 +12,7 @@ using WGneu.Helpers; namespace WGneu.Windows { public partial class MainWindow : Window { - private readonly WgContext Context = new(); + private readonly AppDbContext Context = new(); public MainWindow() { InitializeComponent(); diff --git a/WGneu/Windows/MemberListWindow.xaml.cs b/WGneu/Windows/MemberListWindow.xaml.cs index 54da458..fc2fe38 100644 --- a/WGneu/Windows/MemberListWindow.xaml.cs +++ b/WGneu/Windows/MemberListWindow.xaml.cs @@ -19,7 +19,7 @@ namespace WGneu.Windows { private readonly Dictionary Valid = new(); private readonly Dictionary OriginalValues = new(); private readonly RoutedCommand CtrlF = new(); - private readonly WgContext Context = new(); + private readonly AppDbContext Context = new(); public MemberListWindow() { InitializeComponent();