ef migrations was updated with the requirements of DesignTimeContext.cs
This commit is contained in:
parent
4720c23915
commit
aa5296d084
@ -16,7 +16,7 @@ public class DatabaseContext : DbContext
|
|||||||
|
|
||||||
private string ConnectionString { get; set; }
|
private string ConnectionString { get; set; }
|
||||||
|
|
||||||
public DatabaseContext(IConfiguration appsettings)
|
public DatabaseContext(IConfiguration appsettings, string connectionString)
|
||||||
{
|
{
|
||||||
var connString = appsettings.GetConnectionString(ConfigConnectionStringConst.Database);
|
var connString = appsettings.GetConnectionString(ConfigConnectionStringConst.Database);
|
||||||
ConnectionString = connString ?? "";
|
ConnectionString = connString ?? "";
|
||||||
@ -27,13 +27,24 @@ public class DatabaseContext : DbContext
|
|||||||
ConnectionString = connectionString;
|
ConnectionString = connectionString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DatabaseContext(DbContextOptions<DatabaseContext> connectionString)
|
||||||
|
{
|
||||||
|
ConnectionString = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public DatabaseContext()
|
||||||
|
{
|
||||||
|
ConnectionString = "";
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnConfiguring(DbContextOptionsBuilder options)
|
protected override void OnConfiguring(DbContextOptionsBuilder options)
|
||||||
{
|
{
|
||||||
options.UseNpgsql(ConnectionString);
|
options.UseNpgsql(ConnectionString);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DatabaseContext(DbContextOptions<DatabaseContext> options)
|
public DatabaseContext(DbContextOptions<DatabaseContext> options, string connectionString)
|
||||||
: base(options)
|
: base(options)
|
||||||
{
|
{
|
||||||
|
ConnectionString = connectionString;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,6 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Design;
|
using Microsoft.EntityFrameworkCore.Design;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
|
||||||
namespace Newsbot.Collector.Database;
|
namespace Newsbot.Collector.Database;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user