You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
702 B

2 years ago
  1. using SqlSugar;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. namespace OrmTest.Demo
  7. {
  8. public class DemoBase
  9. {
  10. public static SqlSugarClient GetInstance()
  11. {
  12. SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.SqlServer, IsAutoCloseConnection = true });
  13. db.Aop.OnLogExecuting = (sql, pars) =>
  14. {
  15. Console.WriteLine(sql + "\r\n" + db.Utilities.SerializeObject(pars.ToDictionary(it => it.ParameterName, it => it.Value)));
  16. Console.WriteLine();
  17. };
  18. return db;
  19. }
  20. }
  21. }