修改数据库配置
This commit is contained in:
parent
39fc3918fa
commit
a5a13f1297
@ -135,21 +135,19 @@ namespace ZR.Admin.WebApi
|
|||||||
int dbType = Convert.ToInt32(Configuration[OptionsSetting.ConnDbType]);
|
int dbType = Convert.ToInt32(Configuration[OptionsSetting.ConnDbType]);
|
||||||
int dbType_bus = Convert.ToInt32(Configuration[OptionsSetting.ConnBusDbType]);
|
int dbType_bus = Convert.ToInt32(Configuration[OptionsSetting.ConnBusDbType]);
|
||||||
|
|
||||||
IocConfig db1 = new IocConfig()
|
SugarIocServices.AddSqlSugar(new List<IocConfig>() {
|
||||||
{
|
new IocConfig() {
|
||||||
ConfigId = "0", //主数据库
|
ConfigId = "0", //主数据库
|
||||||
ConnectionString = connStr,
|
ConnectionString = connStr,
|
||||||
DbType = (IocDbType)dbType,
|
DbType = (IocDbType)dbType,
|
||||||
IsAutoCloseConnection = true//自动释放
|
IsAutoCloseConnection = true//自动释放
|
||||||
};
|
}, new IocConfig() {
|
||||||
IocConfig db2 = new IocConfig()
|
|
||||||
{
|
|
||||||
ConfigId = "1", // 多租户用到
|
ConfigId = "1", // 多租户用到
|
||||||
ConnectionString = connStrBus,
|
ConnectionString = connStrBus,
|
||||||
DbType = (IocDbType)dbType_bus,
|
DbType = (IocDbType)dbType_bus,
|
||||||
IsAutoCloseConnection = true//自动释放
|
IsAutoCloseConnection = true//自动释放
|
||||||
};
|
}
|
||||||
SugarIocServices.AddSqlSugar(new List<IocConfig>() { db1, db2 });
|
});
|
||||||
|
|
||||||
//调式代码 用来打印SQL
|
//调式代码 用来打印SQL
|
||||||
DbScoped.SugarScope.GetConnection(0).Aop.OnLogExecuting = (sql, pars) =>
|
DbScoped.SugarScope.GetConnection(0).Aop.OnLogExecuting = (sql, pars) =>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user