Files
Web_AUTSDATA_Mvc_Prod/AUTS.Domain/Entities/SqlSugarBase.cs
2025-11-20 13:11:05 +08:00

100 lines
4.8 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AUTS.Domain.Entities
{
public class SqlSugarBase
{
public static SqlSugarScope Db = new SqlSugarScope(new ConnectionConfig()
{
DbType = SqlSugar.DbType.MySql,
ConnectionString = "Server=blv-rd.tech;Database=uts_manage;Uid=uts_manager;Pwd=WoUts*#082k;charset=utf8;port=3307;",
IsAutoCloseConnection = true
},
db =>
{
//db.DbMaintenance.CreateDatabase(); //个别数据库不支持
//Type[] types = Assembly
//.LoadFrom($@"D:\BLV_SYNC\RD_WEB\SynologyDrive\欧阳磊\cxwMin\cxw\AUTS.Web\bin\AUTS.Domain.dll")//如果 .dll报错可以换成 xxx.exe 有些生成的是exe
//.GetTypes().Where(it => it.FullName.Contains("AUTS.Domain.CxwAll."))//命名空间过滤,当然你也可以写其他条件过滤
//.ToArray();//断点调试一下是不是需要的Type不是需要的在进行过滤
//db.CodeFirst.SetStringDefaultLength(200).InitTables(types);//根据types创建表
//单例参数配置,所有上下文生效
db.Aop.OnLogExecuting = (s, p) =>
{
Debug.WriteLine(s);
};
});
public static SqlSugarScope DbZongQing = new SqlSugarScope(new ConnectionConfig()
{
DbType = SqlSugar.DbType.MySql,
ConnectionString = "Server=blv-rd.tech;Database=uts_ZongQing;Uid=uts_manager;Pwd=WoUts*#082k;charset=utf8;port=3307;",
IsAutoCloseConnection = true
},
db =>
{
//db.DbMaintenance.CreateDatabase(); //个别数据库不支持
//Type[] types = Assembly
//.LoadFrom($@"D:\BLV_SYNC\RD_WEB\SynologyDrive\欧阳磊\cxwMin\cxw\AUTS.Web\bin\AUTS.Domain.dll")//如果 .dll报错可以换成 xxx.exe 有些生成的是exe
//.GetTypes().Where(it => it.FullName.Contains("AUTS.Domain.CxwAll."))//命名空间过滤,当然你也可以写其他条件过滤
//.ToArray();//断点调试一下是不是需要的Type不是需要的在进行过滤
//db.CodeFirst.SetStringDefaultLength(200).InitTables(types);//根据types创建表
//单例参数配置,所有上下文生效
db.Aop.OnLogExecuting = (s, p) =>
{
Debug.WriteLine(s);
};
});
public static SqlSugarScope DbZongQingClone = new SqlSugarScope(new ConnectionConfig()
{
DbType = SqlSugar.DbType.MySql,
ConnectionString = "Server=db.uts-data.com;Database=uts_ZongQing;Uid=uts_manager;Pwd=WoUts*#082k;charset=utf8;port=3307;",
IsAutoCloseConnection = true
},
db =>
{
//db.DbMaintenance.CreateDatabase(); //个别数据库不支持
//Type[] types = Assembly
//.LoadFrom($@"D:\BLV_SYNC\RD_WEB\SynologyDrive\欧阳磊\cxwMin\cxw\AUTS.Web\bin\AUTS.Domain.dll")//如果 .dll报错可以换成 xxx.exe 有些生成的是exe
//.GetTypes().Where(it => it.FullName.Contains("AUTS.Domain.CxwAll."))//命名空间过滤,当然你也可以写其他条件过滤
//.ToArray();//断点调试一下是不是需要的Type不是需要的在进行过滤
//db.CodeFirst.SetStringDefaultLength(200).InitTables(types);//根据types创建表
//单例参数配置,所有上下文生效
db.Aop.OnLogExecuting = (s, p) =>
{
Debug.WriteLine(s);
};
});
public static SqlSugarScope ClientDb = new SqlSugarScope(new ConnectionConfig()
{
DbType = SqlSugar.DbType.MySql,
ConnectionString = "Server=blv-cloud-db.mysql.rds.aliyuncs.com;Database=uts_db;Uid=blv_rcu;Pwd=fnadiaJDIJ7546;charset=utf8;port=3307",
IsAutoCloseConnection = true
},
db =>
{
//db.DbMaintenance.CreateDatabase(); //个别数据库不支持
//Type[] types = Assembly
//.LoadFrom($@"D:\BLV_SYNC\RD_WEB\SynologyDrive\欧阳磊\cxwMin\cxw\AUTS.Web\bin\AUTS.Domain.dll")//如果 .dll报错可以换成 xxx.exe 有些生成的是exe
//.GetTypes().Where(it => it.FullName.Contains("AUTS.Domain.CxwAll."))//命名空间过滤,当然你也可以写其他条件过滤
//.ToArray();//断点调试一下是不是需要的Type不是需要的在进行过滤
//db.CodeFirst.SetStringDefaultLength(200).InitTables(types);//根据types创建表
//单例参数配置,所有上下文生效
db.Aop.OnLogExecuting = (s, p) =>
{
Debug.WriteLine(s);
};
});
}
}