using Brizco.Domain.Entities.User; using Brizco.Repository.Extensions; namespace Brizco.Repository.Models; public class ApplicationContext : IdentityDbContext { private readonly ILogger _logger; private readonly Assembly _projectAssembly; public ApplicationContext( DbContextOptions options, ILogger logger): base(options) { _logger = logger; _projectAssembly = options.GetExtension().ProjectAssembly; } protected override void OnModelCreating(ModelBuilder builder) { var stopwatch = new Stopwatch(); stopwatch.Start(); base.OnModelCreating(builder); var entitiesAssembly = _projectAssembly; builder.RegisterAllEntities(_logger, entitiesAssembly); stopwatch.Stop(); _logger.LogInformation($"!!!!!!! RegisterAllEntities : {stopwatch.ElapsedMilliseconds}ms !!!!!!!"); builder.RegisterEntityTypeConfiguration(entitiesAssembly); builder.AddPluralizingTableNameConvention(); builder.AddRestrictDeleteBehaviorConvention(); //builder.AddSequentialGuidForIdConvention(); } }