SushiBarBase/SushiBar/SushiBarDatabaseImplement/SushiBarDatabase.cs

27 lines
1.1 KiB
C#
Raw Normal View History

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-22 09:46:17 +04:00
optionsBuilder.UseNpgsql(@"Host=localhost;Database=SushiBar_db7;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; }
public virtual DbSet<Client> Clients { set; get; }
2024-05-08 08:52:27 +04:00
public virtual DbSet<Implementer> Implementers { set; get; }
public virtual DbSet<MessageInfo> Messages { set; get; }
2024-03-13 10:24:19 +04:00
}
}