mh_frame_sps/APT.Infrastructure.EF/Infrastructure/ConnectionResolver.cs

34 lines
902 B
C#
Raw Permalink Normal View History

2026-04-07 13:47:52 +08:00
using System;
using APT.Infrastructure.Api;
using Microsoft.Extensions.Configuration;
namespace APT.Infrastructure.EF.Infrastructure
{
public interface IConnectionResolver
{
string GetConnection();
}
public class HttpHeaderSqlConnectionResolver : IConnectionResolver
{
private readonly TenantInfo tenantInfo;
private readonly IConfiguration configuration;
public HttpHeaderSqlConnectionResolver(TenantInfo tenantInfo, IConfiguration configuration)
{
this.tenantInfo = tenantInfo;
this.configuration = configuration;
}
public string GetConnection()
{
var connectionString = string.Empty;
if (!string.IsNullOrEmpty(this.tenantInfo?.Conn))
{
return this.tenantInfo?.Conn;
}
return connectionString;
}
}
}