SushiBarBase/SushiBar/SushiBarDatabaseImplement/SushiBarDatabase.cs

25 lines
1012 B
C#
Raw Permalink 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-04 21:53:45 +04:00
optionsBuilder.UseNpgsql(@"Host=localhost;Database=SushiBar_db5;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-03-13 10:24:19 +04:00
}
}