refactor(infra): register auditable interceptor via DI
Register AuditableEntityInterceptor as a singleton and attach it through the AddDbContext options callback instead of newing it up inside Database.OnConfiguring. The interceptor is stateless, so a single shared instance is reused across contexts and its wiring lives in the DI layer. The design-time factory keeps working (interceptor is runtime-only, irrelevant for migrations). Verified: build + ef migrations list (design-time context) OK; the Worker host builds and validates the full DI graph (reaches endpoint configuration) with no captive-dependency or interceptor error. Build: 0 warnings, 0 errors.
This commit is contained in:
@@ -15,7 +15,6 @@ namespace Musify.Infrastructure.Persistence
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
optionsBuilder.UseNpgsql(configuration.ConnectionString);
|
||||
optionsBuilder.AddInterceptors(new AuditableEntityInterceptor());
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
|
||||
Reference in New Issue
Block a user