-
Notifications
You must be signed in to change notification settings - Fork 2
/
CatalogDbContext.cs
31 lines (25 loc) · 1.07 KB
/
CatalogDbContext.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using BuildingBlocks.Core.Persistence.EfCore;
using ECommerce.Services.Catalogs.Brands;
using ECommerce.Services.Catalogs.Categories;
using ECommerce.Services.Catalogs.Products.Models;
using ECommerce.Services.Catalogs.Shared.Contracts;
using ECommerce.Services.Catalogs.Suppliers;
using Microsoft.EntityFrameworkCore;
namespace ECommerce.Services.Catalogs.Shared.Data;
public class CatalogDbContext : EfDbContextBase, ICatalogDbContext
{
public const string DefaultSchema = "catalog";
public CatalogDbContext(DbContextOptions<CatalogDbContext> options) : base(options)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.ApplyConfigurationsFromAssembly(Assembly.GetExecutingAssembly());
base.OnModelCreating(modelBuilder);
}
public DbSet<Product> Products => Set<Product>();
public DbSet<ProductView> ProductsView => Set<ProductView>();
public DbSet<Category> Categories => Set<Category>();
public DbSet<Supplier> Suppliers => Set<Supplier>();
public DbSet<Brand> Brands => Set<Brand>();
}