DbHelper.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Configuration;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace CP.Dapper
  8. {
  9. public class DbHelper
  10. {
  11. protected MsSqlDatabase db;
  12. public DbHelper(DatabaseLinksEnum link = DatabaseLinksEnum.ZiXun)
  13. {
  14. switch (link)
  15. {
  16. case DatabaseLinksEnum.ZiXun:
  17. db = new MsSqlDatabase(ConfigurationManager.ConnectionStrings["ZiXunSqlService"].ToString());
  18. break;
  19. case DatabaseLinksEnum.ZhuanTi:
  20. db = new MsSqlDatabase(ConfigurationManager.ConnectionStrings["ZhuanTiSqlService"].ToString());
  21. break;
  22. default:
  23. db = new MsSqlDatabase(ConfigurationManager.ConnectionStrings["ZiXunSqlService"].ToString());
  24. break;
  25. //default:
  26. // db = new MsSqlDatabase(ConfigurationManager.ConnectionStrings["KjhSqlService"].ToString());
  27. // break;
  28. }
  29. }
  30. }
  31. }