surtur
421a8f5f62
All checks were successful
continuous-integration/drone/push Build is passing
commit 85cbab22a8d58acf53e32bc122329b50170de1a0 Author: surtur <a_mirre@utb.cz> Date: Wed Dec 30 00:53:27 2020 +0100 chore: update proj file to include Migrations dir commit 71bcd9fa486b761b83ad488d51e9fde5b5d8565f Author: surtur <a_mirre@utb.cz> Date: Tue Dec 29 23:28:17 2020 +0100 chore: prevent deletion of products used in orders commit d9ddee09d78c8e50dbf4f5bcbe07b80294de62e8 Author: surtur <a_mirre@utb.cz> Date: Tue Dec 29 19:45:40 2020 +0100 chore: add db conf for {Product,Carousel,Order} * csproj pkg cleanup commit 66c9c1cb520373b91723e2f4ef8d4bc76e05d8a9 Author: surtur <a_mirre@utb.cz> Date: Tue Dec 29 17:48:09 2020 +0100 chore: create a shared base entity
37 lines
1005 B
C#
37 lines
1005 B
C#
using System;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Npgsql.EntityFrameworkCore;
|
|
using pwt_0x01_ng.Models;
|
|
using pwt_0x01_ng.Models.Database.Conf;
|
|
|
|
namespace pwt_0x01_ng.Models.Database
|
|
{
|
|
public class DBContext : DbContext
|
|
{
|
|
public DBContext(DbContextOptions<DBContext> options) : base(options)
|
|
{
|
|
|
|
}
|
|
|
|
public DbSet<Carousel> Carousel { get; set; }
|
|
public DbSet<Product> Product { get; set; }
|
|
public DbSet<Order> Order { get; set; }
|
|
public DbSet<OrderItem> OrderItem { get; set; }
|
|
|
|
protected override void OnModelCreating(ModelBuilder model_builder)
|
|
{
|
|
base.OnModelCreating(model_builder);
|
|
this.ApplyConfiguration(model_builder);
|
|
}
|
|
|
|
protected virtual void ApplyConfiguration(ModelBuilder model_builder)
|
|
{
|
|
model_builder.ApplyConfiguration(new CarouselConf());
|
|
model_builder.ApplyConfiguration(new ProductConf());
|
|
model_builder.ApplyConfiguration(new OrderConf());
|
|
model_builder.ApplyConfiguration(new OrderItemConf());
|
|
}
|
|
}
|
|
}
|