From 9383a2fb09ffb60cfe63683106945bd688affa59 Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Wed, 1 Jun 2022 21:13:43 +0200 Subject: feat: Initial commit after clean slate --- src/Data/MainDbContext.cs | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/Data/MainDbContext.cs (limited to 'src/Data/MainDbContext.cs') diff --git a/src/Data/MainDbContext.cs b/src/Data/MainDbContext.cs new file mode 100644 index 0000000..c95a4d0 --- /dev/null +++ b/src/Data/MainDbContext.cs @@ -0,0 +1,40 @@ +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); + } +} \ No newline at end of file -- cgit v1.3