29 lines
1.2 KiB
C#
29 lines
1.2 KiB
C#
using FlowerShopDatabaseImplement.Models;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace FlowerShopDatabaseImplement
|
|
{
|
|
public class FlowerShopDatabase : DbContext
|
|
{
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
{
|
|
if (optionsBuilder.IsConfigured == false)
|
|
{
|
|
optionsBuilder.UseNpgsql(@"Host=localhost;Database=FlowerShopHardDatabaseTestFull;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<Flower> Flowers { set; get; }
|
|
public virtual DbSet<FlowerComponent> FlowerComponents { set; get; }
|
|
public virtual DbSet<Order> Orders { set; get; }
|
|
public virtual DbSet<Shop> Shops { set; get; }
|
|
public virtual DbSet<ShopFlower> ShopFlowers { set; get; }
|
|
public virtual DbSet<Client> Clients { set; get; }
|
|
public virtual DbSet<Implementer> Implementers { set; get; }
|
|
}
|
|
}
|