using Learn.Archives.Core.Common.Expand; using SqlSugar; using SqlSugar.IOC; using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; using UserCenter.Model; namespace Learn.Archives.Core.Common { public class Repository : SimpleClient where T : class, new() { public Repository() { SwitchConnection(); } public void SwitchConnection() { var t = typeof(T); if (AppCommon.DbMatserType.Contains(t)) base.Context = DbScoped.Sugar; else if (AppCommon.UserCenterType.Contains(t)) base.Context = DbScoped.Sugar.GetConnectionScope(1001); SqlSugarExpand.SetDbAop(base.Context); } } }