40 lines
1.3 KiB
C#
40 lines
1.3 KiB
C#
using ComputerShopDatabaseImplement.Models;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace ComputerShopDatabaseImplement
|
|
{
|
|
public class ComputerShopDatabase : DbContext
|
|
{
|
|
protected override void OnConfiguring(DbContextOptionsBuilder OptionsBuilder)
|
|
{
|
|
if (!OptionsBuilder.IsConfigured)
|
|
{
|
|
OptionsBuilder.UseNpgsql(@"Host=localhost;Port=5000;Database=ComputerShop;Username=postgres;Password=admin");
|
|
}
|
|
|
|
base.OnConfiguring(OptionsBuilder);
|
|
|
|
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
|
|
AppContext.SetSwitch("Npgsql.DisableDateTimeInfinityConversions", true);
|
|
}
|
|
public virtual DbSet<User> Users { get; set; }
|
|
|
|
public virtual DbSet<Component> Components { get; set; }
|
|
|
|
public virtual DbSet<Assembly> Assemblies { get; set; }
|
|
|
|
public virtual DbSet<AssemblyComponent> AssemblyComponents { get; set; }
|
|
|
|
public virtual DbSet<Product> Products { get; set; }
|
|
|
|
public virtual DbSet<ProductComponent> ProductComponents { get; set; }
|
|
|
|
|
|
public virtual DbSet<Order> Orders { get; set; }
|
|
public virtual DbSet<Request> Requests { get; set; }
|
|
public virtual DbSet<Shipment> Shipments { get; set; }
|
|
public virtual DbSet<ShipmentOrder> ShipmentOrders { get; set; }
|
|
public virtual DbSet<RequestOrder> RequestOrders { get; set; }
|
|
}
|
|
}
|