mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-04-30 12:47:57 +08:00
23 lines
703 B
C#
23 lines
703 B
C#
![]() |
using SqlSugar;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
|
|||
|
namespace OrmTest.Demo
|
|||
|
{
|
|||
|
public class DemoBase
|
|||
|
{
|
|||
|
public static SqlSugarClient GetInstance()
|
|||
|
{
|
|||
|
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.PostgreSQL, IsAutoCloseConnection = true });
|
|||
|
db.Aop.OnLogExecuting = (sql, pars) =>
|
|||
|
{
|
|||
|
Console.WriteLine(sql + "\r\n" + db.Utilities.SerializeObject(pars.ToDictionary(it => it.ParameterName, it => it.Value)));
|
|||
|
Console.WriteLine();
|
|||
|
};
|
|||
|
return db;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|