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-03-14 13:21:05 +04:00
|
|
|
|
optionsBuilder.UseNpgsql(@"Host=localhost;Database=SushiBar_db;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; }
|
|
|
|
|
}
|
|
|
|
|
}
|