ISEbd-22_Baygulov_A.A._Sush.../SushiBar/SushiBarDatabaseImplement/SushiBarDatabase.cs

34 lines
1.2 KiB
C#
Raw Permalink Normal View History

2024-03-28 23:00:05 +04:00
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SushiBarDatabaseImplement.Models;
2024-05-04 15:58:35 +04:00
using Microsoft.Extensions.Options;
2024-03-28 23:00:05 +04:00
namespace SushiBarDatabaseImplement
{
public class SushiBarDatabase : DbContext
{
2024-05-04 15:58:35 +04:00
protected override void OnConfiguring(DbContextOptionsBuilder OptionsBuilder)
{
if (OptionsBuilder.IsConfigured == false)
{
2024-06-01 16:27:44 +04:00
OptionsBuilder.UseNpgsql(@"Host=localhost;Database=SushiBarFull7;Username=postgres;Password=postgres");
2024-05-04 15:58:35 +04:00
}
base.OnConfiguring(OptionsBuilder);
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
AppContext.SetSwitch("Npgsql.DisableDateTimeInfinityConversions", true);
}
public virtual DbSet<Component> Components { set; get; }
2024-03-28 23:00:05 +04:00
public virtual DbSet<Sushi> Sushis { set; get; }
public virtual DbSet<SushiComponent> SushiComponents { set; get; }
public virtual DbSet<Order> Orders { set; get; }
2024-05-03 19:28:58 +04:00
public virtual DbSet<Client> Clients { get; set; }
2024-05-04 18:04:21 +04:00
public virtual DbSet<Implementer> Implementers { set; get; }
2024-06-01 16:27:44 +04:00
public virtual DbSet<MessageInfo> MessageInfos { set; get; }
}
2024-03-28 23:00:05 +04:00
}