zeroframework/Services/DeviceCenter/ZeroFramework.DeviceCenter.Infrastructure/ConnectionStrings/DefaultConnectionStringProvider.cs
2023-12-05 17:22:48 +08:00

18 lines
649 B
C#

using Microsoft.Extensions.Configuration;
using ZeroFramework.DeviceCenter.Infrastructure.Constants;
namespace ZeroFramework.DeviceCenter.Infrastructure.ConnectionStrings
{
public class DefaultConnectionStringProvider(IConfiguration configuration) : IConnectionStringProvider
{
protected readonly IConfiguration _configuration = configuration;
public virtual Task<string> GetAsync(string? connectionStringName = null)
{
connectionStringName ??= DbConstants.DefaultConnectionStringName;
return Task.FromResult(_configuration.GetConnectionString(connectionStringName)!);
}
}
}