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-03-20 10:57:23 +04:00
|
|
|
|
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<Order> Orders { set; get; }
|
|
|
|
|
}
|
|
|
|
|
}
|