features/cutover-to-ef #9
@ -16,7 +16,7 @@ public class DatabaseContext : DbContext
|
||||
|
||||
private string ConnectionString { get; set; }
|
||||
|
||||
public DatabaseContext(IConfiguration appsettings)
|
||||
public DatabaseContext(IConfiguration appsettings, string connectionString)
|
||||
{
|
||||
var connString = appsettings.GetConnectionString(ConfigConnectionStringConst.Database);
|
||||
ConnectionString = connString ?? "";
|
||||
@ -27,13 +27,24 @@ public class DatabaseContext : DbContext
|
||||
ConnectionString = connectionString;
|
||||
}
|
||||
|
||||
public DatabaseContext(DbContextOptions<DatabaseContext> connectionString)
|
||||
{
|
||||
ConnectionString = "";
|
||||
}
|
||||
|
||||
public DatabaseContext()
|
||||
{
|
||||
ConnectionString = "";
|
||||
}
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder options)
|
||||
{
|
||||
options.UseNpgsql(ConnectionString);
|
||||
}
|
||||
|
||||
public DatabaseContext(DbContextOptions<DatabaseContext> options)
|
||||
public DatabaseContext(DbContextOptions<DatabaseContext> options, string connectionString)
|
||||
: base(options)
|
||||
{
|
||||
ConnectionString = connectionString;
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Design;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace Newsbot.Collector.Database;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user