DbHelper.cs 870 B

123456789101112131415161718192021222324252627282930313233343536
  1. using SqlSugar;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Configuration;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace B20UVLog
  9. {
  10. public class DbHelper
  11. {
  12. private static string comConfig = ConfigurationManager.AppSettings["MySql"];
  13. public static SqlSugarScope Db = new(new ConnectionConfig()
  14. {
  15. ConnectionString = comConfig,
  16. DbType = DbType.MySql,
  17. IsAutoCloseConnection = true,
  18. ConfigId = "LogPcDb"
  19. },
  20. db =>
  21. {
  22. // db.DbFirst.IsCreateAttribute()
  23. //.CreateClassFile(@"E:\", "B20UVLog.Models");
  24. // db.Aop.OnLogExecuting = (sql, pars) =>
  25. // {
  26. // Console.WriteLine(sql);//输出sql,查看执行sql 性能无影响
  27. // };
  28. }
  29. );
  30. }
  31. }