diff --git a/ZR.Admin.WebApi/Extensions/DbExtension.cs b/ZR.Admin.WebApi/Extensions/DbExtension.cs index 4183a03..8c1eeaf 100644 --- a/ZR.Admin.WebApi/Extensions/DbExtension.cs +++ b/ZR.Admin.WebApi/Extensions/DbExtension.cs @@ -27,7 +27,7 @@ namespace ZR.Admin.WebApi.Extensions public static void AddDb(IConfiguration Configuration) { string connStr = Configuration.GetConnectionString("conn_db"); - int dbType = Convert.ToInt32(Configuration["conn_db_dbtype"]); + int dbType = Convert.ToInt32(Configuration.GetConnectionString("conn_db_type")); SugarIocServices.AddSqlSugar(new List() { new IocConfig() { diff --git a/ZR.Admin.WebApi/appsettings.json b/ZR.Admin.WebApi/appsettings.json index 3736ced..d3b2d1e 100644 --- a/ZR.Admin.WebApi/appsettings.json +++ b/ZR.Admin.WebApi/appsettings.json @@ -7,9 +7,9 @@ } }, "ConnectionStrings": { - "conn_db": "server=LAPTOP-STKF2M8H\\SQLEXPRESS;uid=sa;pwd=zradmin123;database=ZrAdmin;Trusted_Connection=SSPI" + "conn_db": "Data Source=LAPTOP-STKF2M8H\\SQLEXPRESS;User ID=sa;Password=zradmin123;Initial Catalog=ZrAdmin;Integrated Security=SSPI", //其他连接字符串请看官方文档 + "conn_db_type": "1" //数据库类型 MySql = 0, SqlServer = 1 }, - "conn_db_dbtype": 1, //数据库类型 MySql = 0, SqlServer = 1 "urls": "http://localhost:8888", //项目启动url,如果改动端口前端对应devServer也需要进行修改 "corsUrls": "http://localhost:8887", //跨域地址(前端启动项目,前后端分离单独部署需要设置),多个用","隔开 "JwtSettings": { @@ -32,7 +32,7 @@ "domainUrl": "http://xxx.xxx.com" //访问资源域名 }, "gen": { - "conn": "server=LAPTOP-STKF2M8H\\SQLEXPRESS;user=zr;pwd=abc;database=ZrAdmin;Trusted_Connection=SSPI", + "conn": "Data Source=LAPTOP-STKF2M8H\\SQLEXPRESS;User ID=sa;Password=zradmin123;Initial Catalog=ZrAdmin;Integrated Security=SSPI", "dbType": 1, //MySql = 0, SqlServer = 1 "autoPre": true, //自动去除表前缀 "author": "admin",