using ControlCenter.Models;
using Microsoft.EntityFrameworkCore;
namespace ControlCenter.Data;
///
/// EF Core DbContext for the Control Center database.
///
/// Provides access to all persistent entities.
/// Uses snake_case naming conventions for PostgreSQL columns,
/// applied via .
///
/// Connection string is configured in appsettings.json
/// under ConnectionStrings:ControlCenterDb.
///
public class ControlCenterDbContext : DbContext
{
///
/// Agent state records — one row per active or recently active agent.
/// Maps to the agents table.
///
public DbSet AgentStates => Set();
public ControlCenterDbContext(DbContextOptions options)
: base(options)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
// Apply all entity configurations from this assembly
modelBuilder.ApplyConfigurationsFromAssembly(
typeof(Configurations.AgentStateConfiguration).Assembly);
// Global snake_case naming convention for any unmapped columns
// (explicit configurations take precedence)
base.OnModelCreating(modelBuilder);
}
}