后台数据表建立
This commit is contained in:
@@ -34,8 +34,7 @@ namespace Ewide.EntityFramework.Core
|
||||
|
||||
public string GetDatabaseConnectionString()
|
||||
{
|
||||
var connList = App.GetConfig<List<MutiDBConnectionString>>("ConnectionStrings")?.Where(p => p.Enabled).ToList();
|
||||
var defaultConnection = connList.Find(a => a.Id == "118_3310_ewide")?.ConnectionString;// App.Configuration["ConnectionStrings:DefaultConnection"];
|
||||
var defaultConnection = App.Configuration["DefaultConnection"];
|
||||
|
||||
// 如果没有实现多租户方式,则无需查询
|
||||
if (!typeof(IPrivateMultiTenant).IsAssignableFrom(GetType())) return defaultConnection;
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="dbsettings.Development.json" />
|
||||
<None Remove="dbsettings.json" />
|
||||
<None Remove="dbsettings.Production.json" />
|
||||
<None Remove="sqlsettings.json" />
|
||||
</ItemGroup>
|
||||
@@ -17,9 +16,6 @@
|
||||
</Content>
|
||||
<Content Include="dbsettings.Development.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dbsettings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -19,12 +19,10 @@ namespace Ewide.EntityFramework.Core
|
||||
options.CustomizeMultiTenants(); // 自定义租户
|
||||
|
||||
options.AddDb<DefaultDbContext>();
|
||||
options.AddDb<MultiTenantDbContext, MultiTenantDbContextLocator>();
|
||||
//options.AddDb<MultiTenantDbContext, MultiTenantDbContextLocator>();
|
||||
}, "Ewide.Database.Migrations");
|
||||
var connList = App.GetConfig<List<MutiDBConnectionString>>("ConnectionStrings")?.Where(p => p.Enabled).ToList();
|
||||
// 注册dapper, 目前只能强行写死连接字符串和数据库程序集
|
||||
services.AddDapper(connList.Find(a => a.Id == "118_3310_ewide")?.ConnectionString, SqlProvider.MySql);
|
||||
|
||||
// 注册dapper, 目前只能强行写死连接字符串和数据库程序集
|
||||
services.AddDapper(App.Configuration["DefaultConnection"], SqlProvider.MySql);
|
||||
//sqlsugar的注册代码放到了SqlSugar文件夹里
|
||||
services.AddSqlsugarSetup();
|
||||
//List<ConnectionConfig> connectConfigList = new()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
//DefaultConnection这个节点不能删
|
||||
"DefaultConnection": "",
|
||||
"DefaultConnection": "Data Source=118.178.224.202;Port=3310;Database=yongjiangbei_vote;User ID=root;Password=root.Ewide;pooling=true;sslmode=none;CharSet=utf8;",
|
||||
"ConnectionStrings": [
|
||||
/*
|
||||
MySql = 0,
|
||||
@@ -18,25 +18,11 @@
|
||||
"Connection": "WMBlog.db" // 连接字符串
|
||||
},
|
||||
{
|
||||
//目前使用的数据库
|
||||
//目前使用的数据库 Ewide.
|
||||
"Id": "118_3310_ewide",
|
||||
"DBType": 0,
|
||||
"Enabled": true,
|
||||
"ConnectionString": "Data Source=118.178.224.202;Port=3310;Database=ewide;User ID=root;Password=root.Ewide;pooling=true;sslmode=none;CharSet=utf8;"
|
||||
},
|
||||
{
|
||||
//郑总的线上测试数据库
|
||||
"Id": "zhengzong_testdb",
|
||||
"DBType": 0,
|
||||
"Enabled": true,
|
||||
"ConnectionString": "Data Source=42.192.248.196;Port=3306;Database=roadflow;User ID=joy;Password=db2202;pooling=true;sslmode=none;CharSet=utf8;"
|
||||
},
|
||||
{
|
||||
//118上合并roadflow之前的数据库
|
||||
"Id": "118_3306_old_ewide",
|
||||
"DBType": 0,
|
||||
"Enabled": true,
|
||||
"ConnectionString": "Data Source=118.178.224.202;Port=3306;Database=ewide;User ID=root;Password=root;pooling=true;sslmode=none;CharSet=utf8;"
|
||||
"ConnectionString": ";"
|
||||
},
|
||||
{
|
||||
//不知道干什么用的
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
{
|
||||
//DefaultConnection这个节点不能删
|
||||
"DefaultConnection": "",
|
||||
"ConnectionStrings": [
|
||||
/*
|
||||
MySql = 0,
|
||||
SqlServer = 1,
|
||||
Sqlite = 2,
|
||||
Oracle = 3,
|
||||
PostgreSQL = 4,
|
||||
Dm = 5,
|
||||
Kdbndp = 6
|
||||
*/
|
||||
{
|
||||
"Id": 1, // 连接id,可以配置到数据库
|
||||
"DBType": 2, // db类型,枚举,具体的看上边
|
||||
"Enabled": false, // 是否开启当前数据库db
|
||||
"Connection": "WMBlog.db" // 连接字符串
|
||||
},
|
||||
{
|
||||
//目前使用的数据库
|
||||
"Id": "118_3310_ewide",
|
||||
"DBType": 0,
|
||||
"Enabled": true,
|
||||
"ConnectionString": "Data Source=118.178.224.202;Port=3310;Database=ewide;User ID=root;Password=root.Ewide;pooling=true;sslmode=none;CharSet=utf8;"
|
||||
},
|
||||
{
|
||||
//郑总的线上测试数据库
|
||||
"Id": "zhengzong_testdb",
|
||||
"DBType": 0,
|
||||
"Enabled": true,
|
||||
"ConnectionString": "Data Source=42.192.248.196;Port=3306;Database=roadflow;User ID=joy;Password=db2202;pooling=true;sslmode=none;CharSet=utf8;"
|
||||
},
|
||||
{
|
||||
//118上合并roadflow之前的数据库
|
||||
"Id": "118_3306_old_ewide",
|
||||
"DBType": 0,
|
||||
"Enabled": true,
|
||||
"ConnectionString": "Data Source=118.178.224.202;Port=3306;Database=ewide;User ID=root;Password=root;pooling=true;sslmode=none;CharSet=utf8;"
|
||||
},
|
||||
{
|
||||
//不知道干什么用的
|
||||
"Id": "PgSqlConnection",
|
||||
"DBType": 4,
|
||||
"Enabled": true,
|
||||
"ConnectionString": "HOST=127.0.0.1;PORT=5432;DATABASE=ewide;PASSWORD=postgres;USER ID=postgres;"
|
||||
},
|
||||
{
|
||||
|
||||
"Id": "MultiTenantConnection",
|
||||
"DBType": 2,
|
||||
"Enabled": true,
|
||||
"ConnectionString": "Data Source=./Dilon_SaaS.db"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
//DefaultConnection这个节点不能删
|
||||
"DefaultConnection": "",
|
||||
"DefaultConnection": "Data Source=localhost;Port=3310;Database=yongjiangbei_vote;User ID=root;Password=Ewide.;pooling=true;sslmode=none;CharSet=utf8;",
|
||||
"ConnectionStrings": [
|
||||
/*
|
||||
MySql = 0,
|
||||
@@ -18,25 +18,11 @@
|
||||
"Connection": "WMBlog.db" // 连接字符串
|
||||
},
|
||||
{
|
||||
//目前使用的数据库
|
||||
//目前使用的数据库 Ewide.
|
||||
"Id": "118_3310_ewide",
|
||||
"DBType": 0,
|
||||
"Enabled": true,
|
||||
"ConnectionString": "Data Source=118.178.224.202;Port=3310;Database=ewide;User ID=root;Password=root.Ewide;pooling=true;sslmode=none;CharSet=utf8;"
|
||||
},
|
||||
{
|
||||
//郑总的线上测试数据库
|
||||
"Id": "zhengzong_testdb",
|
||||
"DBType": 0,
|
||||
"Enabled": true,
|
||||
"ConnectionString": "Data Source=42.192.248.196;Port=3306;Database=roadflow;User ID=joy;Password=db2202;pooling=true;sslmode=none;CharSet=utf8;"
|
||||
},
|
||||
{
|
||||
//118上合并roadflow之前的数据库
|
||||
"Id": "118_3306_old_ewide",
|
||||
"DBType": 0,
|
||||
"Enabled": true,
|
||||
"ConnectionString": "Data Source=118.178.224.202;Port=3306;Database=ewide;User ID=root;Password=root;pooling=true;sslmode=none;CharSet=utf8;"
|
||||
"ConnectionString": ""
|
||||
},
|
||||
{
|
||||
//不知道干什么用的
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
{
|
||||
//DefaultConnection这个节点不能删
|
||||
"DefaultConnection": "",
|
||||
"ConnectionStrings": [
|
||||
/*
|
||||
MySql = 0,
|
||||
SqlServer = 1,
|
||||
Sqlite = 2,
|
||||
Oracle = 3,
|
||||
PostgreSQL = 4,
|
||||
Dm = 5,
|
||||
Kdbndp = 6
|
||||
*/
|
||||
{
|
||||
"Id": 1, // 连接id,可以配置到数据库
|
||||
"DBType": 2, // db类型,枚举,具体的看上边
|
||||
"Enabled": false, // 是否开启当前数据库db
|
||||
"Connection": "WMBlog.db" // 连接字符串
|
||||
},
|
||||
{
|
||||
//目前使用的数据库
|
||||
"Id": "118_3310_ewide",
|
||||
"DBType": 0,
|
||||
"Enabled": true,
|
||||
"ConnectionString": "Data Source=118.178.224.202;Port=3310;Database=ewide;User ID=root;Password=root.Ewide;pooling=true;sslmode=none;CharSet=utf8;"
|
||||
},
|
||||
{
|
||||
//郑总的线上测试数据库
|
||||
"Id": "zhengzong_testdb",
|
||||
"DBType": 0,
|
||||
"Enabled": true,
|
||||
"ConnectionString": "Data Source=42.192.248.196;Port=3306;Database=roadflow;User ID=joy;Password=db2202;pooling=true;sslmode=none;CharSet=utf8;"
|
||||
},
|
||||
{
|
||||
//118上合并roadflow之前的数据库
|
||||
"Id": "118_3306_old_ewide",
|
||||
"DBType": 0,
|
||||
"Enabled": true,
|
||||
"ConnectionString": "Data Source=118.178.224.202;Port=3306;Database=ewide;User ID=root;Password=root;pooling=true;sslmode=none;CharSet=utf8;"
|
||||
},
|
||||
{
|
||||
//不知道干什么用的
|
||||
"Id": "PgSqlConnection",
|
||||
"DBType": 4,
|
||||
"Enabled": true,
|
||||
"ConnectionString": "HOST=127.0.0.1;PORT=5432;DATABASE=ewide;PASSWORD=postgres;USER ID=postgres;"
|
||||
},
|
||||
{
|
||||
|
||||
"Id": "MultiTenantConnection",
|
||||
"DBType": 2,
|
||||
"Enabled": true,
|
||||
"ConnectionString": "Data Source=./Dilon_SaaS.db"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user