using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Newsbot.Collector.Domain.Consts; using Newsbot.Collector.Domain.Entities; namespace Newsbot.Collector.Database; public class DatabaseContext : IdentityDbContext { public DbSet Articles { get; set; } = null!; public DbSet DiscordNotification { get; set; } = null!; public DbSet DiscordQueue { get; set; } = null!; public DbSet DiscordWebhooks { get; set; } = null!; public DbSet Icons { get; set; } = null!; public DbSet Sources { get; set; } = null!; public DbSet UserSourceSubscription { get; set; } = null!; public DbSet RefreshTokens { get; set; } = null!; private string ConnectionString { get; set; } = ""; //public DatabaseContext(IConfiguration appsettings, string connectionString) //{ // var connString = appsettings.GetConnectionString(ConfigConnectionStringConst.Database); // ConnectionString = connString ?? ""; //} public DatabaseContext(string connectionString) { ConnectionString = connectionString; } protected override void OnConfiguring(DbContextOptionsBuilder options) { if (ConnectionString != "") { options.UseNpgsql(ConnectionString); } } //public DatabaseContext(DbContextOptions connectionString) //{ // ConnectionString = ""; //} //public DatabaseContext() //{ // ConnectionString = ""; //} public DatabaseContext(DbContextOptions options) : base(options) { //ConnectionString = ""; } public DatabaseContext(DbContextOptions options, string connectionString) : base(options) { //ConnectionString = connectionString; } }