Renamed WgContext to AppDbContext
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
using WGneu.Models;
|
using WGneu.Models;
|
||||||
|
|
||||||
namespace WGneu.Helpers {
|
namespace WGneu.Helpers {
|
||||||
public class WgContext : DbContext {
|
public class AppDbContext : DbContext {
|
||||||
public DbSet<Country> Countries { get; set; }
|
public DbSet<Country> Countries { get; set; }
|
||||||
public DbSet<Member> Members { get; set; }
|
public DbSet<Member> Members { get; set; }
|
||||||
public DbSet<AT_Gem> Gemeinden { get; set; }
|
public DbSet<AT_Gem> Gemeinden { get; set; }
|
||||||
@ -20,7 +20,6 @@ namespace WGneu.Helpers {
|
|||||||
public DbSet<WineQual> WineQualities { get; set; }
|
public DbSet<WineQual> WineQualities { get; set; }
|
||||||
public DbSet<WineVar> WineVarieties { get; set; }
|
public DbSet<WineVar> WineVarieties { get; set; }
|
||||||
|
|
||||||
|
|
||||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) {
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) {
|
||||||
optionsBuilder.UseSqlite("Data Source=\"C:\\Users\\lorenz\\Desktop\\wgtest.sqlite3\"; foreign keys=true");
|
optionsBuilder.UseSqlite("Data Source=\"C:\\Users\\lorenz\\Desktop\\wgtest.sqlite3\"; foreign keys=true");
|
||||||
optionsBuilder.UseLazyLoadingProxies();
|
optionsBuilder.UseLazyLoadingProxies();
|
@ -32,7 +32,7 @@ namespace WGneu.Models {
|
|||||||
[ForeignKey("CountryCode")]
|
[ForeignKey("CountryCode")]
|
||||||
public virtual Country Country { get; set; }
|
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();
|
return ctx.Postleitzahlen.Where(p => p.Plz == Plz).ToHashSet();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ namespace WGneu.Models {
|
|||||||
[ForeignKey("CountryCode")]
|
[ForeignKey("CountryCode")]
|
||||||
public virtual Country Country { get; set; }
|
public virtual Country Country { get; set; }
|
||||||
|
|
||||||
public AT_Plz? Plz(WgContext ctx) {
|
public AT_Plz? Plz(AppDbContext ctx) {
|
||||||
// TODO getter
|
// TODO getter
|
||||||
if (CountryCode != "AT") return null;
|
if (CountryCode != "AT") return null;
|
||||||
return ctx.Postleitzahlen.Where(p => p.Id == Id).FirstOrDefault();
|
return ctx.Postleitzahlen.Where(p => p.Id == Id).FirstOrDefault();
|
||||||
|
@ -8,7 +8,7 @@ using WGneu.Models;
|
|||||||
|
|
||||||
namespace WGneu.Windows {
|
namespace WGneu.Windows {
|
||||||
public partial class ContractListWindow : Window {
|
public partial class ContractListWindow : Window {
|
||||||
private readonly WgContext Context = new();
|
private readonly AppDbContext Context = new();
|
||||||
|
|
||||||
public ContractListWindow(Member member) {
|
public ContractListWindow(Member member) {
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
@ -12,7 +12,7 @@ using WGneu.Helpers;
|
|||||||
|
|
||||||
namespace WGneu.Windows {
|
namespace WGneu.Windows {
|
||||||
public partial class MainWindow : Window {
|
public partial class MainWindow : Window {
|
||||||
private readonly WgContext Context = new();
|
private readonly AppDbContext Context = new();
|
||||||
|
|
||||||
public MainWindow() {
|
public MainWindow() {
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
@ -19,7 +19,7 @@ namespace WGneu.Windows {
|
|||||||
private readonly Dictionary<Control, bool> Valid = new();
|
private readonly Dictionary<Control, bool> Valid = new();
|
||||||
private readonly Dictionary<Control, object?> OriginalValues = new();
|
private readonly Dictionary<Control, object?> OriginalValues = new();
|
||||||
private readonly RoutedCommand CtrlF = new();
|
private readonly RoutedCommand CtrlF = new();
|
||||||
private readonly WgContext Context = new();
|
private readonly AppDbContext Context = new();
|
||||||
|
|
||||||
public MemberListWindow() {
|
public MemberListWindow() {
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
Reference in New Issue
Block a user