[backend/database] Revert "Remove configuration parsing for DesignTimeDbContext, as we don't need a valid database connection string"
This change made migration reverts impossible.
This reverts commit 64ef76be10
.
This commit is contained in:
parent
5be537e7dd
commit
82dfd5db1b
1 changed files with 8 additions and 3 deletions
|
@ -1285,9 +1285,14 @@ public class DesignTimeDatabaseContextFactory : IDesignTimeDbContextFactory<Data
|
||||||
{
|
{
|
||||||
DatabaseContext IDesignTimeDbContextFactory<DatabaseContext>.CreateDbContext(string[] args)
|
DatabaseContext IDesignTimeDbContextFactory<DatabaseContext>.CreateDbContext(string[] args)
|
||||||
{
|
{
|
||||||
var npgsqlBuilder = new NpgsqlDataSourceBuilder { ConnectionStringBuilder = { Host = "localhost" } };
|
var configuration = new ConfigurationBuilder()
|
||||||
var dataSource = DatabaseContext.ConfigureDataSource(npgsqlBuilder);
|
.SetBasePath(Directory.GetCurrentDirectory())
|
||||||
var builder = new DbContextOptionsBuilder<DatabaseContext>();
|
.AddCustomConfiguration()
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
var config = configuration.GetSection("Database").Get<Config.DatabaseSection>();
|
||||||
|
var dataSource = DatabaseContext.GetDataSource(config);
|
||||||
|
var builder = new DbContextOptionsBuilder<DatabaseContext>();
|
||||||
DatabaseContext.Configure(builder, dataSource);
|
DatabaseContext.Configure(builder, dataSource);
|
||||||
return new DatabaseContext(builder.Options);
|
return new DatabaseContext(builder.Options);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue