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.

45 lines
1.0 KiB

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 Aop
  9. {
  10. public static void Init()
  11. {
  12. SqlSugarClient db = new SqlSugarClient(new ConnectionConfig() { ConnectionString = Config.ConnectionString, DbType = DbType.SqlServer, IsAutoCloseConnection = true });
  13. db.Aop.OnLogExecuted = (sql, pars) =>
  14. {
  15. };
  16. db.Aop.OnLogExecuting = (sql, pars) =>
  17. {
  18. };
  19. db.Aop.OnError = (exp) =>
  20. {
  21. };
  22. db.Aop.OnExecutingChangeSql = (sql, pars) =>
  23. {
  24. return new KeyValuePair<string, SugarParameter[]>(sql,pars);
  25. };
  26. db.Queryable<CMStudent>().ToList();
  27. try
  28. {
  29. db.Queryable<CMStudent>().AS(" ' ").ToList();
  30. }
  31. catch (Exception)
  32. {
  33. }
  34. }
  35. }
  36. }