26 lines
1.1 KiB
C#
26 lines
1.1 KiB
C#
using Microsoft.EntityFrameworkCore;
|
|
using SushiBarDatabaseImplement.Models;
|
|
|
|
namespace SushiBarDatabaseImplement
|
|
{
|
|
public class SushiBarDatabase : DbContext
|
|
{
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
{
|
|
if (optionsBuilder.IsConfigured == false)
|
|
{
|
|
optionsBuilder.UseNpgsql(@"Host=localhost;Database=SushiBar_db6;Username=postgres;Password=postgres");
|
|
}
|
|
base.OnConfiguring(optionsBuilder);
|
|
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
|
|
AppContext.SetSwitch("Npgsql.DisableDateTimeInfinityConversions", true);
|
|
}
|
|
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; }
|
|
public virtual DbSet<Implementer> Implementers { set; get; }
|
|
}
|
|
}
|