using HardwareShopDatabaseImplement.Models; using HardwareShopDatabaseImplement.Models.ManyToMany; using HardwareShopDatabaseImplement.Models.Storekeeper; using HardwareShopDatabaseImplement.Models.Worker; using Microsoft.EntityFrameworkCore; namespace HardwareShopDatabaseImplement { public class HardwareShopDatabase : DbContext { protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { optionsBuilder.UseNpgsql("Host=localhost;Port=5432;Database=Computer_Hardware_Store;Username=postgres;Password=1234"); } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity().HasKey(x => new { x.ComponentId, x.BuildId }); modelBuilder.Entity().HasKey(x => new { x.PurchaseId, x.BuildId }); modelBuilder.Entity().HasKey(x => new { x.PurchaseId, x.GoodId }); } public virtual DbSet Builds { set; get; } public virtual DbSet BuildsComponents { set; get; } public virtual DbSet Comments { set; get; } public virtual DbSet Components { set; get; } public virtual DbSet Goods { set; get; } public virtual DbSet Orders { set; get; } public virtual DbSet Purchases { set; get; } public virtual DbSet PurchasesBuilds { set; get; } public virtual DbSet PurchasesGoods { set; get; } public virtual DbSet Users { set; get; } } }