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");
|
|
|
|
|
//optionsBuilder.UseSqlServer(@"Data Source=USER\SQLEXPRESS;Initial Catalog=FlowerShopDatabaseFull;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
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; }
|
|
|
|
|
}
|
|
|
|
|
}
|