MdpIngestDatabase.cs 958 B

123456789101112131415161718192021222324
  1. namespace Admin.NET.Plugin.AiDOP.DataPlatform.UnifiedIngress;
  2. internal static class MdpIngestDatabase
  3. {
  4. internal static SqlSugarClient Open(ISqlSugarClient host)
  5. {
  6. var connections = host.AsTenant();
  7. var config = connections.IsAnyConnection(SqlSugarConst.MainConfigId)
  8. ? connections.GetConnectionScope(SqlSugarConst.MainConfigId).CurrentConnectionConfig
  9. : host.CurrentConnectionConfig;
  10. // 复用主库连接池和列映射,避免 SQL 日志展开原文和接入凭据。
  11. var client = new SqlSugarClient(new ConnectionConfig
  12. {
  13. DbType = config.DbType,
  14. ConnectionString = config.ConnectionString,
  15. ConfigureExternalServices = config.ConfigureExternalServices,
  16. InitKeyType = config.InitKeyType,
  17. IsAutoCloseConnection = true
  18. });
  19. client.Ado.CommandTimeOut = host.Ado.CommandTimeOut;
  20. return client;
  21. }
  22. }