using Microsoft.EntityFrameworkCore; namespace AnsonBot.Core; public class BotDbContext : DbContext { public BotDbContext(DbContextOptions options) : base(options) { } public DbSet PlaySessions => Set(); protected override void OnModelCreating(ModelBuilder b) { var session = b.Entity(); session.Ignore(s => s.Duration); // Main lookup: "is this player currently online" and per-player history. session.HasIndex(s => new { s.PlayerId, s.EndedUtc }); // Supports finding all open sessions on startup for crash recovery. session.HasIndex(s => s.EndedUtc); } }