@@ -0,0 +1,26 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using ROLAC.API.Entities.Logging;
|
||||
|
||||
namespace ROLAC.API.Data.Logging;
|
||||
|
||||
/// <summary>
|
||||
/// A minimal, write-mostly context dedicated to the SystemLog / AuditLog tables. It is the
|
||||
/// structural break that prevents log-storms: it is registered WITHOUT the audit interceptors
|
||||
/// and with a silent logger factory (see Program.cs), so persisting a log row produces no log
|
||||
/// events that the DB sink would pick up. It shares the same physical database/connection as
|
||||
/// AppDbContext, but the tables themselves are created by AppDbContext's migration — they are
|
||||
/// only mapped here so this context can read/write them.
|
||||
/// </summary>
|
||||
public class LogDbContext : DbContext
|
||||
{
|
||||
public LogDbContext(DbContextOptions<LogDbContext> options) : base(options) { }
|
||||
|
||||
public DbSet<SystemLog> SystemLogs => Set<SystemLog>();
|
||||
public DbSet<AuditLog> AuditLogs => Set<AuditLog>();
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder builder)
|
||||
{
|
||||
base.OnModelCreating(builder);
|
||||
LogModelConfiguration.Configure(builder);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user