2024-03-13 10:24:19 +04:00
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
using SushiBarDatabaseImplement.Models;
|
|
|
|
|
|
|
|
|
|
namespace SushiBarDatabaseImplement
|
|
|
|
|
{
|
|
|
|
|
public class SushiBarDatabase : DbContext
|
|
|
|
|
{
|
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
|
|
|
{
|
|
|
|
|
if (optionsBuilder.IsConfigured == false)
|
|
|
|
|
{
|
2024-05-08 08:52:27 +04:00
|
|
|
|
optionsBuilder.UseNpgsql(@"Host=localhost;Database=SushiBar_db6;Username=postgres;Password=postgres");
|
2024-03-13 10:24:19 +04:00
|
|
|
|
}
|
|
|
|
|
base.OnConfiguring(optionsBuilder);
|
2024-03-14 13:21:05 +04:00
|
|
|
|
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
|
|
|
|
|
AppContext.SetSwitch("Npgsql.DisableDateTimeInfinityConversions", true);
|
2024-03-13 10:24:19 +04:00
|
|
|
|
}
|
|
|
|
|
public virtual DbSet<Component> Components { set; get; }
|
|
|
|
|
public virtual DbSet<Sushi> Sushis { set; get; }
|
|
|
|
|
public virtual DbSet<SushiComponent> SushiComponents { set; get; }
|
|
|
|
|
public virtual DbSet<Order> Orders { set; get; }
|
2024-04-28 20:26:49 +04:00
|
|
|
|
public virtual DbSet<Client> Clients { set; get; }
|
2024-05-08 08:52:27 +04:00
|
|
|
|
public virtual DbSet<Implementer> Implementers { set; get; }
|
2024-03-13 10:24:19 +04:00
|
|
|
|
}
|
|
|
|
|
}
|