using Furion; using SqlSugar; using System.Collections.Generic; namespace cylsg.Core; /// /// 数据库上下文对象 /// public static class DbContext { public static List connectionConfigs { get { var list = App.GetConfig>("ConnectionConfigs"); foreach (var config in list) { config.ConfigureExternalServices = new ConfigureExternalServices() { DataInfoCacheService = new SqlSugarRedisCache() }; } return list; } } /// /// SqlSugar 数据库实例 /// public static readonly SqlSugarScope Instance = new( // 读取 appsettings.json 中的 ConnectionConfigs 配置节点 //App.GetConfig>("ConnectionConfigs") connectionConfigs , db => { // 这里配置全局事件,比如拦截执行 SQL var a = 100; }); }