宁波既有建筑外墙脱落问卷调查

This commit is contained in:
范露尧
2023-06-28 23:07:04 +08:00
parent 22d312934d
commit 352c658960
62 changed files with 3721 additions and 611 deletions

View File

@@ -1,7 +1,6 @@
using Ewide.Core;
using Ewide.Core.Service;
using Ewide.Core.Util;
using Ewide.EntityFramework.Core.SqlSugar;
using Furion;
using Furion.DatabaseAccessor;
using Furion.FriendlyException;

View File

@@ -1,76 +0,0 @@
using Furion;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Ewide.EntityFramework.Core.SqlSugar
{
public static class SqlsugarSetup
{
public static void AddSqlsugarSetup(this IServiceCollection services)
{
var connList = App.GetConfig<List<MutiDBConnectionString>>("ConnectionStrings")?.Where(p => p.Enabled).ToList();
List<ConnectionConfig> connectConfigList = new();
connList.ForEach(conn =>
{
connectConfigList.Add(new ConnectionConfig
{
ConfigId = conn.Id,
ConnectionString = conn.ConnectionString,
DbType = conn.DbType,
IsAutoCloseConnection = true,
InitKeyType = InitKeyType.Attribute
});
});
services.AddSqlSugar(connectConfigList.ToArray(), db =>
{
//处理日志事务
db.Aop.OnLogExecuting = (sql, pars) =>
{
Debugger.Log(1, "", $"===================CurrentConfigId:{db.CurrentConnectionConfig.ConfigId} SqlSugar log started ===================\r\n");
Debugger.Log(2, "语句:", sql);
Debugger.Log(3, "参数:", string.Join(",", pars?.Select(it => it.ParameterName + ":" + it.Value)));
Debugger.Log(4, "", $"===================CurrentConfigId:{db.CurrentConnectionConfig.ConfigId} SqlSugar log end ===================\r\n");
//App.PrintToMiniProfiler("SqlSugar", "Info", sql + "\r\n" + db.Utilities.SerializeObject(pars.ToDictionary(it => it.ParameterName, it => it.Value)));
};
});
////如果多个数数据库传 List<ConnectionConfig>
//var configConnection = new ConnectionConfig()
//{
// DbType = SqlSugar.DbType.MySql,
// ConnectionString = configuration.GetConnectionString(dbName),
// IsAutoCloseConnection = true,
//};
//SqlSugarScope sqlSugar = new SqlSugarScope(configConnection,
// db =>
// {
// //单例参数配置,所有上下文生效
// db.Aop.OnLogExecuting = (sql, pars) =>
// {
// //Console.WriteLine(sql);//输出sql
// };
// });
//services.AddSingleton<ISqlSugarClient>(sqlSugar);//这边是SqlSugarScope用AddSingleton
}
}
public class MutiDBConnectionString
{
public string Id { get; set; }
public string ConnectionString { get; set; }
public DbType DbType { get; set; }
public bool Enabled { get; set; }
public string ProviderName { get; set; }
}
}

View File

@@ -1,5 +1,5 @@
using Dapper;
using Ewide.EntityFramework.Core.SqlSugar;
using Ewide.Core;
using Furion;
using Furion.DatabaseAccessor;
using Microsoft.Extensions.DependencyInjection;

View File

@@ -11,18 +11,18 @@
Dm = 5,
Kdbndp = 6
*/
{
"Id": 1, // 连接id可以配置到数据库
"DBType": 2, // db类型枚举具体的看上边
"Enabled": false, // 是否开启当前数据库db
"Connection": "WMBlog.db" // 连接字符串
},
{
//目前使用的数据库 Ewide.
"Id": "118_3310_ewide",
"DBType": 0,
"Enabled": true,
"ConnectionString": ";"
"ConnectionString": "Data Source=118.178.224.202;Port=3310;Database=yongjiangbei_vote;User ID=root;Password=root.Ewide;pooling=true;sslmode=none;CharSet=utf8;"
},
{
"Id": 1, // 连接id可以配置到数据库
"DBType": 2, // db类型枚举具体的看上边
"Enabled": false, // 是否开启当前数据库db
"Connection": "WMBlog.db" // 连接字符串
},
{
//不知道干什么用的