Renamed WgContext to AppDbContext
This commit is contained in:
@ -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();
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
Reference in New Issue
Block a user