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.

SqlMapper.cs 1.4KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using Dapper;
  2. using Microsoft.Extensions.Configuration;
  3. using MySql.Data.MySqlClient;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Data;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using TelpoPush.Models.CacheTemplates;
  11. namespace TelpoPush.Service.Cache
  12. {
  13. public class SqlMapper
  14. {
  15. private readonly IConfiguration _config;
  16. private static string gps_conn = "";
  17. private static string telcommon_conn = "";
  18. private static string healthy_conn = "";
  19. public SqlMapper(IConfiguration config)
  20. {
  21. _config = config;
  22. gps_conn = _config["ConnectionStrings:DB_Connection_String"].ToString();
  23. telcommon_conn = _config["ConnectionStrings:Telpo_common_ConnString"].ToString();
  24. healthy_conn = _config["ConnectionStrings:Telpo_Healthy_ConnString"].ToString();
  25. }
  26. public List<ManufactorKafkaModel> ManufactorKafkaTopicQuery()
  27. {
  28. using (IDbConnection connection = new MySqlConnection(telcommon_conn))
  29. {
  30. var sql = @"SELECT manufactor_id manufactorId,manufactor_name manufactorName,kafka_servers kafkaServers,kafka_topic kafkaTopic,kafka_username kafkaUsername, kafka_password kafkaPassword FROM manufactor_real_monitor";
  31. return connection.Query<ManufactorKafkaModel>(sql).ToList();
  32. }
  33. }
  34. }
  35. }