Use DbContext with options.
This commit is contained in:
parent
cbcfb5536d
commit
d67d05d6a2
@ -3,7 +3,13 @@ using EntityFrameworkCore.Domain;
|
||||
using Microsoft.Data.Sqlite;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
using var context = new DeadBallZoneLeagueDbContext();
|
||||
|
||||
var folder = Environment.SpecialFolder.LocalApplicationData;
|
||||
var path = Environment.GetFolderPath(folder);
|
||||
var dbPath = Path.Combine(path, "DeadBallZoneLeague_EFCore.db");
|
||||
var optionsBuilder = new DbContextOptionsBuilder<DeadBallZoneLeagueDbContext>();
|
||||
optionsBuilder.UseSqlite($"Data Source={dbPath}");
|
||||
using var context = new DeadBallZoneLeagueDbContext(optionsBuilder.Options);
|
||||
// context.Database.Migrate(); // Can be used to automatically migrate on run.
|
||||
context.Database.EnsureCreated();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user