From a52ebe75b15e930b2be253e65e2bd827c19133dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ph=E1=BA=A1m=20H=E1=BB=93ng=20Ph=C3=BAc?= Date: Sun, 11 Aug 2024 16:41:45 +0700 Subject: [PATCH] [BDB-3] Handle ApplyConfigurationsFromAssembly in BaseDbContext (#9) --- .../BaseDbContext.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Infrastructures/BuildingBlock.Infrastructure.EntityFrameworkCore/BaseDbContext.cs b/Infrastructures/BuildingBlock.Infrastructure.EntityFrameworkCore/BaseDbContext.cs index c0d045a..bf55cf8 100644 --- a/Infrastructures/BuildingBlock.Infrastructure.EntityFrameworkCore/BaseDbContext.cs +++ b/Infrastructures/BuildingBlock.Infrastructure.EntityFrameworkCore/BaseDbContext.cs @@ -5,7 +5,7 @@ namespace BuildingBlock.Infrastructure.EntityFrameworkCore; -public class BaseDbContext : DbContext +public abstract class BaseDbContext : DbContext { private readonly ICurrentUser _currentUser; private readonly IMediator _mediator; @@ -18,6 +18,8 @@ protected BaseDbContext(DbContextOptions options, ICurrentUser currentUser, IMed protected override void OnModelCreating(ModelBuilder builder) { + builder.ApplyConfigurationsFromAssembly(GetType().Assembly); + base.OnModelCreating(builder); }