feat(configdb): AuditLogRepository (EF) + DI registration, append-only with M6-deferred SwitchOutPartition (#23)
EF Core implementation of IAuditLogRepository: - InsertIfNotExistsAsync: single IF NOT EXISTS ... INSERT via ExecuteSqlInterpolatedAsync, bypasses the change tracker. Enum values converted to string in C# (columns are varchar(32) via HasConversion<string>). - QueryAsync: AsNoTracking, predicate-per-non-null-filter, keyset paging on (OccurredAtUtc DESC, EventId DESC) — EF Core 10 translates Guid.CompareTo to a uniqueidentifier < comparison natively (verified against MSSQL 2022). - SwitchOutPartitionAsync: throws NotSupportedException naming M6; the non-aligned UX_AuditLog_EventId unique index blocks ALTER TABLE SWITCH PARTITION until the drop-and-rebuild dance ships with the purge actor. DI: AddScoped<IAuditLogRepository, AuditLogRepository>() added after the NotificationOutboxRepository registration; existing DI smoke test extended with an IAuditLogRepository assertion. Integration tests (8 new) use the Bundle C MsSqlMigrationFixture and scope by a per-test SourceSiteId guid so they neither collide nor require cleanup. Bundle D of the Audit Log #23 M1 Foundation plan.
This commit is contained in:
@@ -18,6 +18,7 @@ public class ServiceCollectionExtensionsTests
|
||||
Assert.Contains(services, d => d.ServiceType == typeof(ITemplateEngineRepository));
|
||||
Assert.Contains(services, d => d.ServiceType == typeof(IAuditService));
|
||||
Assert.Contains(services, d => d.ServiceType == typeof(IInstanceLocator));
|
||||
Assert.Contains(services, d => d.ServiceType == typeof(IAuditLogRepository));
|
||||
}
|
||||
|
||||
// The no-arg overload is [Obsolete(error: true)], so it cannot be referenced directly
|
||||
|
||||
Reference in New Issue
Block a user