Description
AuditDbContext.OnModelCreating() does not call base.OnModelCreating(modelBuilder), which means the soft-delete global query filter and Finbuckle multi-tenant
filters defined in BaseDbContext are never applied to audit records.
Location
src/Modules/Auditing/Modules.Auditing/Persistence/AuditDbContext.cs
Current code
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
ArgumentNullException.ThrowIfNull(modelBuilder);
modelBuilder.ApplyConfigurationsFromAssembly(typeof(AuditDbContext).Assembly);
// ← missing base.OnModelCreating(modelBuilder)
}
Expected code
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
ArgumentNullException.ThrowIfNull(modelBuilder);
modelBuilder.ApplyConfigurationsFromAssembly(typeof(AuditDbContext).Assembly);
base.OnModelCreating(modelBuilder);
}
Impact
BaseDbContext.OnModelCreating() applies a global query filter for soft-delete:
modelBuilder.AppendGlobalQueryFilter<ISoftDeletable>(s => !s.IsDeleted);
And BaseDbContext inherits from Finbuckle's MultiTenantDbContext, whose OnModelCreating configures multi-tenant query filters.
Without the base call:
1. Soft-deleted audit records are still returned by queries (the ISoftDeletable filter is not applied)
2. Multi-tenant isolation is broken for audit data — a tenant could potentially see audit records from other tenants
Fix
One-line addition: base.OnModelCreating(modelBuilder); at the end of the method override.
Description
AuditDbContext.OnModelCreating()does not callbase.OnModelCreating(modelBuilder), which means the soft-delete global query filter and Finbuckle multi-tenantfilters defined in
BaseDbContextare never applied to audit records.Location
src/Modules/Auditing/Modules.Auditing/Persistence/AuditDbContext.csCurrent code