SUBD_SushiBar/SushiBar/SushiBarDatabaseImplement/SushiBarDatabase.cs

35 lines
1.3 KiB
C#

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)
{
optionsBuilder.UseNpgsql(@"Host=localhost;Database=SUBDLab8;Username=postgres;Password=shotboll200412");
}
base.OnConfiguring(optionsBuilder);
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
AppContext.SetSwitch("Npgsql.DisableDateTimeInfinityConversions", true);
}
//optionsBuilder.UseNpgsql(@"Host=localhost;Database=ComputersShop_db;Username=postgres;Password=postgres");
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; }
}
}