using SqlSugar; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace WIDESEA_Core.Helper { public class SqlSugarHelper { //多库情况下使用说明: //如果是固定多库可以传 new SqlSugarScope(List,db=>{}) 文档:多租户 //如果是不固定多库 可以看文档Saas分库 //用单例模式 public static SqlSugarScope Db = new SqlSugarScope(new ConnectionConfig() { ConnectionString = "Data Source=.;Initial Catalog=WIDESEAWCS_TEST;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",//连接符字串 DbType = DbType.SqlServer,//数据库类型 IsAutoCloseConnection = true //不设成true要手动close }, db => { }); } }