using Microsoft.EntityFrameworkCore; using VSH.Data.Database; namespace VSH.Data; public class MainDbContext : DbContext { public MainDbContext(DbContextOptions options) : base(options) { } public DbSet Users { get; set; } public DbSet Categories { get; set; } public DbSet Products { get; set; } public DbSet Orders { get; set; } public DbSet Documents { get; set; } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity(e => { e.ToTable("Users"); }); modelBuilder.Entity(e => { e.ToTable("Categories"); }); modelBuilder.Entity(e => { e.Property(c => c.Products).HasColumnType("jsonb"); e.Property(c => c.ContactInfo).HasColumnType("jsonb"); e.ToTable("Orders"); }); modelBuilder.Entity(e => { e.Property(c => c.Images).HasColumnType("jsonb"); e.ToTable("Products"); }); modelBuilder.Entity(e => { e.ToTable("Documents"); }); base.OnModelCreating(modelBuilder); } }