stabilizaiton work - projects rework for maintenanceability and ui livening
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace StellaOps.Provcache.Postgres;
|
||||
|
||||
public sealed partial class PostgresProvcacheRepository
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public async Task<ProvcacheEntry?> GetAsync(string veriKey, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var entity = await _context.ProvcacheItems
|
||||
.AsNoTracking()
|
||||
.FirstOrDefaultAsync(e => e.VeriKey == veriKey, cancellationToken)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
return entity is null ? null : MapToEntry(entity);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<IReadOnlyDictionary<string, ProvcacheEntry>> GetManyAsync(
|
||||
IEnumerable<string> veriKeys,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
var keyList = veriKeys.ToList();
|
||||
if (keyList.Count == 0)
|
||||
return new Dictionary<string, ProvcacheEntry>();
|
||||
|
||||
var entities = await _context.ProvcacheItems
|
||||
.AsNoTracking()
|
||||
.Where(e => keyList.Contains(e.VeriKey))
|
||||
.ToListAsync(cancellationToken)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
return entities.ToDictionary(e => e.VeriKey, MapToEntry);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user