zeroframework/Services/DeviceCenter/ZeroFramework.DeviceCenter.Infrastructure/ConnectionStrings/DefaultConnectionStringProvider.cs

18 lines
649 B
C#
Raw Normal View History

2023-12-05 09:22:48 +00:00
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)!);
}
}
}