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.
 
 

29 regels
759 B

  1. using SqlSugar;
  2. using System;
  3. using System.Linq;
  4. namespace DataVApi.Order
  5. {
  6. public class SugarDb
  7. {
  8. public static string Conn { get; set; }
  9. public SqlSugarScope DbContext()
  10. {
  11. SqlSugarScope client = new SqlSugarScope(new ConnectionConfig
  12. {
  13. ConnectionString = Conn,
  14. DbType = DbType.SqlServer,
  15. InitKeyType = InitKeyType.Attribute,
  16. IsAutoCloseConnection = true
  17. });
  18. client.Aop.OnLogExecuting = (sql, pars) =>
  19. {
  20. Console.WriteLine($"当前SQL语句:【{sql}】,参数:【{string.Join(",", pars.Select(t => t.Value))}】");
  21. };
  22. return client;
  23. }
  24. }
  25. }