update DbProvider.cs
This commit is contained in:
parent
b2f440668c
commit
67ef7e3fc1
@ -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<IocConfig>() {
|
||||
new IocConfig() {
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using Infrastructure;
|
||||
using Infrastructure.Extensions;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -28,8 +29,16 @@ namespace ZR.CodeGenerator
|
||||
|
||||
if (!string.IsNullOrEmpty(dbName))
|
||||
{
|
||||
string replaceStr = GetValue(connStr, "database=", ";");
|
||||
connStr = connStr.Replace(replaceStr, dbName);
|
||||
string replaceStr = GetValue(connStr, "Database=", ";");
|
||||
string replaceStr2 = GetValue(connStr, "Initial Catalog=", ";");
|
||||
if (replaceStr.IsNotEmpty())
|
||||
{
|
||||
connStr = connStr.Replace(replaceStr, dbName, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
if (replaceStr2.IsNotEmpty())
|
||||
{
|
||||
connStr = connStr.Replace(replaceStr2, dbName, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
var db = new SqlSugarClient(new List<ConnectionConfig>()
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user