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

26 lines
1.1 KiB
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-05-13 22:15:56 +04:00
optionsBuilder.UseNpgsql(@"Host=localhost;Database=FishFactory3;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<Client> Clients { set; get; }
public virtual DbSet<Order> Orders { set; get; }
public virtual DbSet<Implementer> Implementers { set; get; }
2024-03-17 21:00:26 +04:00
}
}