32 lines
1.1 KiB
C#
32 lines
1.1 KiB
C#
using Microsoft.EntityFrameworkCore;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using SushiBarDatabaseImplement.Models;
|
|
using Microsoft.Extensions.Options;
|
|
|
|
namespace SushiBarDatabaseImplement
|
|
{
|
|
public class SushiBarDatabase : DbContext
|
|
{
|
|
protected override void OnConfiguring(DbContextOptionsBuilder OptionsBuilder)
|
|
{
|
|
if (OptionsBuilder.IsConfigured == false)
|
|
{
|
|
OptionsBuilder.UseNpgsql(@"Host=localhost;Database=SushiBarFull5;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 { get; set; }
|
|
}
|
|
} |