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

25 lines
1013 B
C#
Raw Permalink 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)
{
optionsBuilder.UseNpgsql(@"Host=localhost;Database=FishFactory2;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; }
2024-03-17 21:00:26 +04:00
}
}