Renamed WgContext to AppDbContext

This commit is contained in:
2023-03-11 15:33:05 +01:00
parent 8d61fdd35e
commit 40c158df36
6 changed files with 6 additions and 7 deletions

View File

@ -2,7 +2,7 @@
using WGneu.Models;
namespace WGneu.Helpers {
public class WgContext : DbContext {
public class AppDbContext : DbContext {
public DbSet<Country> Countries { get; set; }
public DbSet<Member> Members { get; set; }
public DbSet<AT_Gem> Gemeinden { get; set; }
@ -20,7 +20,6 @@ namespace WGneu.Helpers {
public DbSet<WineQual> WineQualities { get; set; }
public DbSet<WineVar> WineVarieties { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) {
optionsBuilder.UseSqlite("Data Source=\"C:\\Users\\lorenz\\Desktop\\wgtest.sqlite3\"; foreign keys=true");
optionsBuilder.UseLazyLoadingProxies();

View File

@ -32,7 +32,7 @@ namespace WGneu.Models {
[ForeignKey("CountryCode")]
public virtual Country Country { get; set; }
public ISet<AT_Plz> Orte(WgContext ctx) {
public ISet<AT_Plz> Orte(AppDbContext ctx) {
return ctx.Postleitzahlen.Where(p => p.Plz == Plz).ToHashSet();
}
}

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -19,7 +19,7 @@ namespace WGneu.Windows {
private readonly Dictionary<Control, bool> Valid = new();
private readonly Dictionary<Control, object?> OriginalValues = new();
private readonly RoutedCommand CtrlF = new();
private readonly WgContext Context = new();
private readonly AppDbContext Context = new();
public MemberListWindow() {
InitializeComponent();