PIbd-31_Rodionov.I.A._COP_28/COP/PortalAccountsDatabaseImplement/PortalAccountsDatabase.cs
2024-10-22 19:42:03 +04:00

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; }
}
}