Update vor Umbau Service

This commit is contained in:
Stefan Hutter
2026-02-13 06:42:52 +01:00
parent 41588e8c92
commit 9e64ca707d
925 changed files with 1109250 additions and 584 deletions

View File

@@ -0,0 +1,46 @@
using Newtonsoft.Json;
using System.IO;
using System.Web;
namespace WebApp
{
public class TableConfigRoot
{
public System.Collections.Generic.List<TableConfig> 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 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<TableConfigRoot>(json);
if (_cache.Tables == null) _cache.Tables = new System.Collections.Generic.List<TableConfig>();
return _cache;
}
public static void ResetCache() => _cache = null;
}
}