2024-04-21 13:27:17 +04:00
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
using SushiBarDatabaseImplement.Models;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Data.Common;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace SushiBarDatabaseImplement
|
|
|
|
|
{
|
|
|
|
|
public class SushiBarDatabase : DbContext
|
|
|
|
|
{
|
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
|
|
|
{
|
|
|
|
|
if (optionsBuilder.IsConfigured == false)
|
|
|
|
|
{
|
2024-05-07 21:53:37 +04:00
|
|
|
|
optionsBuilder.UseNpgsql(@"Host=localhost;Database=SUBDLab8;Username=postgres;Password=shotboll200412");
|
2024-04-21 13:27:17 +04:00
|
|
|
|
}
|
|
|
|
|
base.OnConfiguring(optionsBuilder);
|
2024-05-07 21:53:37 +04:00
|
|
|
|
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
|
|
|
|
|
AppContext.SetSwitch("Npgsql.DisableDateTimeInfinityConversions", true);
|
2024-04-21 13:27:17 +04:00
|
|
|
|
}
|
|
|
|
|
|
2024-05-07 21:53:37 +04:00
|
|
|
|
//optionsBuilder.UseNpgsql(@"Host=localhost;Database=ComputersShop_db;Username=postgres;Password=postgres");
|
|
|
|
|
|
2024-04-21 13:27:17 +04:00
|
|
|
|
public virtual DbSet<Buyer> Buyers { get; set; }
|
|
|
|
|
public virtual DbSet<Cook> Cooks { get; set; }
|
|
|
|
|
public virtual DbSet<Menu> Menus { get; set; }
|
|
|
|
|
public virtual DbSet<Place> Places { get; set; }
|
|
|
|
|
public virtual DbSet<Models.Task> Tasks { get; set; }
|
|
|
|
|
public virtual DbSet<TaskMenu> TaskMenus { get; set; }
|
|
|
|
|
}
|
|
|
|
|
}
|