PIbd-22_Chernyshev_Shabunov.../ComputerShopDatabaseImplement/ComputerShopDatabase.cs

21 lines
658 B
C#
Raw Normal View History

2024-04-17 17:38:54 +04:00
using Microsoft.EntityFrameworkCore;
namespace ComputerShopDatabaseImplement
{
public class ComputerShopDatabase : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder OptionsBuilder)
{
if (!OptionsBuilder.IsConfigured)
{
OptionsBuilder.UseNpgsql(@"Host=localhost;Database=ComputerShop;Username=postgres;Password=admin");
}
base.OnConfiguring(OptionsBuilder);
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
AppContext.SetSwitch("Npgsql.DisableDateTimeInfinityConversions", true);
}
}
}