PIbd21_Makarov_DV_FlowerShop/FlowerShop/FlowerShopDatabaseImplement/FlowerShopDatabase.cs

26 lines
1.1 KiB
C#
Raw Normal View History

2024-03-09 17:32:17 +04:00
using FlowerShopDatabaseImplement.Models;
using Microsoft.EntityFrameworkCore;
namespace FlowerShopDatabaseImplement
{
public class FlowerShopDatabase : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (optionsBuilder.IsConfigured == false)
{
2024-04-04 00:39:31 +04:00
optionsBuilder.UseNpgsql(@"Host=localhost;Database=FlowerShopDatabaseFull;Username=postgres;Password=postgres");
2024-03-09 17:32:17 +04:00
}
base.OnConfiguring(optionsBuilder);
2024-04-04 00:39:31 +04:00
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
AppContext.SetSwitch("Npgsql.DisableDataTimeInfinityConversions", true);
2024-03-09 17:32:17 +04:00
}
public virtual DbSet<Component> Components { set; get; }
public virtual DbSet<Flower> Flowers { set; get; }
public virtual DbSet<FlowerComponent> FlowerComponents { set; get; }
public virtual DbSet<Order> Orders { set; get; }
2024-04-04 18:22:29 +04:00
public virtual DbSet<Client> Clients { set; get; }
public virtual DbSet<Implementer> Implementers { set; get; }
2024-03-09 17:32:17 +04:00
}
}