23 lines
850 B
C#
23 lines
850 B
C#
|
using PortalAccountsDatabaseImplement.Models;
|
|||
|
using Microsoft.EntityFrameworkCore;
|
|||
|
|
|||
|
namespace PortalAccountsDatabaseImplement
|
|||
|
{
|
|||
|
public class PortalAccountsDatabase : DbContext
|
|||
|
{
|
|||
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|||
|
{
|
|||
|
if (optionsBuilder.IsConfigured == false)
|
|||
|
{
|
|||
|
optionsBuilder.UseNpgsql(@"Host=localhost;Database=portal_accounts_database;Username=postgres;Password=bythop423956");
|
|||
|
}
|
|||
|
base.OnConfiguring(optionsBuilder);
|
|||
|
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
|
|||
|
AppContext.SetSwitch("Npgsql.DisableDateTimeInfinityConversions", true);
|
|||
|
}
|
|||
|
|
|||
|
public virtual DbSet<Account> Accounts { set; get; }
|
|||
|
|
|||
|
public virtual DbSet<Role> Roles { set; get; }
|
|||
|
}
|
|||
|
}
|