using Newtonsoft.Json; using System.IO; using System.Security.Permissions; using System.Web; namespace WebApp { public class TableConfigRoot { public System.Collections.Generic.List Tables { get; set; } } public class TableConfig { public string Key { get; set; } public string DisplayName { get; set; } public string SqlList { get; set; } public string SqlById { get; set; } public string IdField { get; set; } public string DisplayField { get; set; } public string JsonField { get; set; } public string Buttons { get; set; } public string AnzeigeDokument { get; set; } public string FilterColumns { get; set; } } public static class TableConfigProvider { private static TableConfigRoot _cache; public static TableConfigRoot LoadConfig() { if (_cache != null) return _cache; // ✅ HttpContext.Current verwenden statt Context string path = HttpContext.Current.Server.MapPath("~/App_Data/TableConfig.json"); if (!File.Exists(path)) throw new FileNotFoundException("TableConfig.json nicht gefunden", path); string json = File.ReadAllText(path); _cache = JsonConvert.DeserializeObject(json); if (_cache.Tables == null) _cache.Tables = new System.Collections.Generic.List(); return _cache; } public static void ResetCache() => _cache = null; } }