From 24fb6d95e0416ac3c00a93b87359567e45568a89 Mon Sep 17 00:00:00 2001 From: Shuxia Ning <NingShuxia0927@outlook.com> Date: 星期二, 17 十二月 2024 10:07:13 +0800 Subject: [PATCH] 曲线关联 bug更新 --- Service/HStation.Service.Assets.Core/00-core/ConfigHelper.cs | 93 ++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 93 insertions(+), 0 deletions(-) diff --git a/Service/HStation.Service.Assets.Core/00-core/ConfigHelper.cs b/Service/HStation.Service.Assets.Core/00-core/ConfigHelper.cs new file mode 100644 index 0000000..d0ac06f --- /dev/null +++ b/Service/HStation.Service.Assets.Core/00-core/ConfigHelper.cs @@ -0,0 +1,93 @@ +锘縩amespace HStation.Assets +{ + internal class ConfigHelper + { + /// <summary> + /// 榛樿杩炴帴閰嶇疆 + /// </summary> + internal static ConnectionConfig DefaultConnectionConfig + { + get + { + ConnectionConfig connectConfig = null; + switch (AssetsParasHelper.Assets.DataBase.DbType) + { + case DbType.PostgreSql: + { + connectConfig = PostgreSqlConnectionConfig; + } + break; + + case DbType.SQLite: + { + connectConfig = SQLiteConnectionConfig; + } + break; + + default: break; + } + return connectConfig; + } + } + + /// <summary> + /// PostgreSql杩炴帴閰嶇疆 + /// </summary> + internal static ConnectionConfig PostgreSqlConnectionConfig + { + get + { + //SnowFlakeSingle.WorkId = Settings.SqlSugar.SnowFlakeWorkId; 涓嶅悓鏈哄櫒閰嶇疆鐨勫敮涓�鏁板瓧; // 鍗曟湇鍔″櫒涓嶉渶瑕佹寚瀹� + return new ConnectionConfig() + { + DbType = SqlSugar.DbType.PostgreSQL,//鏁版嵁搴撶被鍨� + ConnectionString = HStation.Settings.AssetsParasHelper.Assets.DataBase.PostgreSql.ConnectString, + IsAutoCloseConnection = true,//鏄惁鑷姩鍏抽棴 + MoreSettings = new ConnMoreSettings() + { + //PgSqlIsAutoToLower = false //鏁版嵁搴撳瓨鍦ㄥぇ鍐欏瓧娈电殑 锛岄渶瑕佹妸杩欎釜璁句负false 锛屽苟涓斿疄浣撳拰瀛楁鍚嶇О瑕佷竴鏍� + }, + AopEvents = new AopEvents + { + OnLogExecuting = (sql, p) => + { + // var sqlString = UtilMethods.GetNativeSql(sql, p); + //LogHelper.Debug(sqlString); + // Console.WriteLine(sql); + } + } + }; + } + } + + /// <summary> + /// SQLite杩炴帴閰嶇疆 + /// </summary> + internal static ConnectionConfig SQLiteConnectionConfig + { + get + { + //SnowFlakeSingle.WorkId = Settings.SqlSugar.SnowFlakeWorkId; 涓嶅悓鏈哄櫒閰嶇疆鐨勫敮涓�鏁板瓧; // 鍗曟湇鍔″櫒涓嶉渶瑕佹寚瀹� + return new ConnectionConfig() + { + DbType = SqlSugar.DbType.Sqlite,//鏁版嵁搴撶被鍨� + ConnectionString = AssetsParasHelper.Assets.DataBase.SQLite.ConnectString, + IsAutoCloseConnection = true,//鏄惁鑷姩鍏抽棴 + MoreSettings = new ConnMoreSettings() + { + //PgSqlIsAutoToLower = false //鏁版嵁搴撳瓨鍦ㄥぇ鍐欏瓧娈电殑 锛岄渶瑕佹妸杩欎釜璁句负false 锛屽苟涓斿疄浣撳拰瀛楁鍚嶇О瑕佷竴鏍� + }, + AopEvents = new AopEvents + { + OnLogExecuting = (sql, p) => + { + // var sqlString = UtilMethods.GetNativeSql(sql, p); + //LogHelper.Debug(sqlString); + // Console.WriteLine(sql); + } + } + }; + } + } + } +} \ No newline at end of file -- Gitblit v1.9.3