21 lines
658 B
C#
21 lines
658 B
C#
|
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);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|