protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); using (var dbContext = new WpfApp1DbContext()) { dbContext.Database.EnsureCreated(); } }
public MainWindow() { InitializeComponent(); using (var dbContext = new WpfApp1DbContext()) { var whatsInTheDatabase = dbContext.Settings.ToList(); dbContext.Settings.Add(new Setting { Name = "Background" }); dbContext.SaveChanges(); } }