Unnesting the Blazor and moving the database to root
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Design;
|
||||
|
||||
namespace DeepDrftWeb.Data;
|
||||
|
||||
public static class DeepDrftContextFactory
|
||||
{
|
||||
public class Factory : IDesignTimeDbContextFactory<DeepDrftContext>
|
||||
{
|
||||
public DeepDrftContext CreateDbContext(string[] args)
|
||||
{
|
||||
var configuration = new ConfigurationBuilder()
|
||||
.SetBasePath(Directory.GetCurrentDirectory())
|
||||
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
|
||||
.AddJsonFile("appsettings.Development.json", optional: true, reloadOnChange: true)
|
||||
.Build();
|
||||
|
||||
var optionsBuilder = new DbContextOptionsBuilder<DeepDrftContext>();
|
||||
optionsBuilder.UseSqlite(configuration.GetConnectionString("DefaultConnection"));
|
||||
|
||||
return new DeepDrftContext(optionsBuilder.Options);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user