From 1ca160f3c19af115955531098f898803b2d63fb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8D=E5=81=9A=E7=A0=81=E5=86=9C?= <599854767@qq.com> Date: Tue, 31 May 2022 11:45:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5=E5=AD=97=E7=AC=A6=E4=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ZR.Admin.WebApi/Extensions/DbExtension.cs | 2 +- ZR.Admin.WebApi/appsettings.json | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) 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",