PIbd-22_Isaeva_A.I._FishFac.../FishFactoryDatabaseImplement/FishFactoryDatabase.cs

24 lines
965 B
C#
Raw Normal View History

2024-03-17 21:00:26 +04:00
using FishFactoryDatabaseImplement.Models;
using Microsoft.EntityFrameworkCore;
namespace FishFactoryDatabaseImplement
{
public class FishFactoryDatabase : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (optionsBuilder.IsConfigured == false)
{
2024-04-10 19:04:19 +04:00
optionsBuilder.UseNpgsql(@"Host=localhost;Database=FishFactory;Username=postgres;Password=postgres");
2024-03-17 21:00:26 +04:00
}
base.OnConfiguring(optionsBuilder);
2024-03-19 20:55:45 +04:00
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
AppContext.SetSwitch("Npgsql.DisableDateTimeInfinityConversions", true);
2024-03-17 21:00:26 +04:00
}
public virtual DbSet<Component> Components { set; get; }
public virtual DbSet<Canned> Canneds { set; get; }
public virtual DbSet<CannedComponent> CannedComponents { set; get; }
public virtual DbSet<Order> Orders { set; get; }
}
}