using Common.Configuration; namespace Common; public sealed class AppConfig { // 使用 Lazy 实现线程安全的懒加载单例 private static readonly Lazy _instance = new Lazy(() => new AppConfig()); // 提供全局访问点 public static AppConfig Instance => _instance.Value; // 私有构造函数,防止外部实例化 private AppConfig() { var model = ConfigReader.LoadConfig(); ConfigModel = model; } /// /// 全局配置 /// public AppConfigModel ConfigModel { get; } /// /// WebSocket 端口 /// public int WebSocketPort { get; set; } /// /// WebSocket 连接地址 /// public string? WebSocketPath { get; set; } }