50 lines
1.4 KiB
C#
50 lines
1.4 KiB
C#
using EgwCoreLib.Lux.Data.DbModel.Config;
|
|
using EgwCoreLib.Lux.Data.Repository.Config;
|
|
using Microsoft.Extensions.Configuration;
|
|
using StackExchange.Redis;
|
|
|
|
namespace EgwCoreLib.Lux.Data.Services.Config
|
|
{
|
|
public class EnvirParamService : BaseServ, IEnvirParamService
|
|
{
|
|
#region Public Constructors
|
|
|
|
public EnvirParamService(
|
|
IConfiguration config,
|
|
IConnectionMultiplexer redis,
|
|
IEnvirParamRepository repo) : base(config, redis)
|
|
{
|
|
_className = "EnvirParam";
|
|
_repo = repo;
|
|
}
|
|
|
|
#endregion Public Constructors
|
|
|
|
#region Public Methods
|
|
|
|
/// <summary>
|
|
/// Elenco completo EnvirParam da DB
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public async Task<List<EnvirParamModel>> GetAllAsync()
|
|
{
|
|
return await TraceAsync($"{_className}.GetAll", async (activity) =>
|
|
{
|
|
return await GetOrSetCacheAsync(
|
|
$"{_redisBaseKey}:{_className}:ALL",
|
|
async () => await _repo.GetAllAsync(),
|
|
UltraLongCache
|
|
);
|
|
});
|
|
}
|
|
|
|
#endregion Public Methods
|
|
|
|
#region Private Fields
|
|
|
|
private readonly string _className;
|
|
private readonly IEnvirParamRepository _repo;
|
|
|
|
#endregion Private Fields
|
|
}
|
|
} |