using Microsoft.EntityFrameworkCore; using RadicadeServer.DB; using RadicadeServer.RecNet.Config; namespace RadicadeServer.Utils { public static class GameConfigSeeder { public static async Task FindAsync(RecDBContext db, string key) => db.GameConfig.Local.FirstOrDefault(row => row.Key == key) ?? await db.GameConfig.FirstOrDefaultAsync(row => row.Key == key); public static async Task UpsertAsync(RecDBContext db, string key, string value) { var existing = await FindAsync(db, key); if (existing == null) { var added = new ConfigVal(key, value); await db.GameConfig.AddAsync(added); return added; } if (string.IsNullOrWhiteSpace(existing.Value)) existing.Value = value; return existing; } } }