AppDbContext.cs 611 B

12345678910111213141516171819
  1. using Application.Abstractions.Data;
  2. using Domain.Entities.Common;
  3. using Microsoft.EntityFrameworkCore;
  4. namespace Infrastructure.Persistence
  5. {
  6. public sealed class AppDbContext : DbContext, IAppDbContext
  7. {
  8. public AppDbContext(DbContextOptions<AppDbContext> options) : base(options) { }
  9. public DbSet<Config> Config { get; set; }
  10. protected override void OnModelCreating(ModelBuilder modelBuilder)
  11. {
  12. // Apply all configurations from the current assembly
  13. modelBuilder.ApplyConfigurationsFromAssembly(typeof(AppDbContext).Assembly);
  14. }
  15. }
  16. }