Skip to content

Commit

Permalink
feat: add entity configurations to context
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikoo-Asadnejad committed May 3, 2024
1 parent 655fa95 commit 6b457d9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion Src/Product.Infrastructure/Data/Context/CommandContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ namespace Product.Infrastructure.Data.Context;

public class CommandContext : DbContext
{

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.ApplyConfigurationsFromAssembly(typeof(IEntityTypeConfiguration<>).Assembly);
}
}
5 changes: 4 additions & 1 deletion Src/Product.Infrastructure/Data/Context/QueryContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@ public QueryContext(DbContextOptions<QueryContext> options) : base(options)
{

}

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.ApplyConfigurationsFromAssembly(typeof(IEntityTypeConfiguration<>).Assembly);
}
}

0 comments on commit 6b457d9

Please sign in to comment.