using SqlSugar; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Uninpho.DBOperation { /// /// Setting up the database name does not require you to create the database /// 设置好数据库名不需要你去手动建库 /// public class Config { /// /// 自动化打印,true选择打印 /// public static bool zdhjc = true; public static SqlSugarClient GetPgClient() { return new SqlSugarClient(new ConnectionConfig() { DbType = DbType.PostgreSQL, ConnectionString = System.Configuration.ConfigurationManager.AppSettings["dbConnection"] as string, InitKeyType = InitKeyType.Attribute, IsAutoCloseConnection = true, AopEvents = new AopEvents { OnLogExecuting = (sql, p) => { if (zdhjc) { Console.WriteLine(sql); Console.WriteLine(string.Join(",", p?.Select(it => it.ParameterName + ":" + it.Value))); } } } }); } } }