Continuo migrazione repository

This commit is contained in:
Samuele Locatelli
2026-06-01 19:12:12 +02:00
parent a34dd4cc79
commit fa46fe89e5
15 changed files with 34 additions and 26 deletions
+9 -9
View File
@@ -157,7 +157,7 @@ namespace MP.SPEC.Data
using var activity = ActivitySource.StartActivity("AnagCountersGetNextAsync");
AnagCountersModel result = new AnagCountersModel();
string source = "DB";
result = await dbController.AnagCountersGetNextAsync(cntType);
result = await _anagRepository.AnagCountersGetNextAsync(cntType);
activity?.SetTag("data.source", source);
activity?.Stop();
LogTrace($"AnagCountersGetNextAsync | {source} | {activity?.Duration.TotalMilliseconds}ms");
@@ -176,7 +176,7 @@ namespace MP.SPEC.Data
expiration: GetRandTOut(redisLongTimeCache),
fetchFunc: async () =>
{
return await dbController.AnagEventiGeneralAsync() ?? new List<vSelEventiBCodeModel>();
return await _anagRepository.AnagEventiGeneralAsync() ?? new List<vSelEventiBCodeModel>();
},
tagList: [Utils.redisEventList]
);
@@ -191,7 +191,7 @@ namespace MP.SPEC.Data
using var activity = ActivitySource.StartActivity("AnagGruppiDeleteAsync");
bool result = false;
string source = "DB";
result = await dbController.AnagGruppiDeleteAsync(updRec);
result = await _anagRepository.AnagGruppiDeleteAsync(updRec);
// elimino cache redis...
await FlushFusionCacheAsync(Utils.redisAnagGruppi);
activity?.SetTag("data.source", source);
@@ -210,7 +210,7 @@ namespace MP.SPEC.Data
using var activity = ActivitySource.StartActivity("AnagGruppiUpsertAsync");
bool result = false;
string source = "DB";
result = await dbController.AnagGruppiUpsertAsync(UpdRec);
result = await _anagRepository.AnagGruppiUpsertAsync(UpdRec);
// elimino cache redis...
await FlushFusionCacheAsync(Utils.redisAnagGruppi);
activity?.SetTag("data.source", source);
@@ -328,7 +328,6 @@ namespace MP.SPEC.Data
public async Task<List<AnagArticoliModel>> ArticoliGetSearchAsync(int numRecord, string tipoArt, string azienda, string searchVal)
{
string sKey = string.IsNullOrWhiteSpace(searchVal) ? "***" : searchVal.Trim();
string redisKey = $"{Utils.redisArtList}:{tipoArt}:{azienda}:{sKey}:{numRecord}";
return await GetOrFetchAsync(
@@ -336,7 +335,8 @@ namespace MP.SPEC.Data
cacheKey: redisKey,
expiration: GetRandTOut(redisLongTimeCache),
fetchFunc: async () =>
await dbController.ArticoliGetSearchAsync(numRecord, tipoArt, azienda, searchVal) ?? new List<AnagArticoliModel>(),
await _anagRepository.ArticoliGetSearchAsync(numRecord, tipoArt, azienda, searchVal) ?? new List<AnagArticoliModel>(),
//await dbController.ArticoliGetSearchAsync(numRecord, tipoArt, azienda, searchVal) ?? new List<AnagArticoliModel>(),
tagList: [Utils.redisArtList, $"{Utils.redisArtList}:Search"]
);
}
@@ -648,7 +648,7 @@ namespace MP.SPEC.Data
cacheKey: $"{Utils.redisAnagGruppi}:Aziende",
expiration: GetRandTOut(redisLongTimeCache * 2),
fetchFunc: async () =>
await dbController.AnagGruppiAziendeAsync() ?? new List<AnagGruppiModel>(),
await _anagRepository.AnagGruppiAziendeAsync() ?? new List<AnagGruppiModel>(),
tagList: [Utils.redisAnagGruppi, $"{Utils.redisAnagGruppi}:Aziende"]
);
}
@@ -663,7 +663,7 @@ namespace MP.SPEC.Data
operationName: "ElencoGruppiFaseAsync",
cacheKey: $"{Utils.redisAnagGruppi}:FASE",
expiration: GetRandTOut(redisLongTimeCache),
fetchFunc: async () => await dbController.AnagGruppiFaseAsync() ?? new List<AnagGruppiModel>(),
fetchFunc: async () => await _anagRepository.AnagGruppiFaseAsync() ?? new List<AnagGruppiModel>(),
tagList: [Utils.redisAnagGruppi]
);
}
@@ -693,7 +693,7 @@ namespace MP.SPEC.Data
operationName: "ElencoRepartiDtoAsync",
cacheKey: $"{Utils.redisAnagGruppi}:REPARTO",
expiration: GetRandTOut(redisLongTimeCache),
fetchFunc: async () => await dbController.AnagGruppiRepartoDtoAsync() ?? new(),
fetchFunc: async () => await _anagRepository.AnagGruppiRepartoDtoAsync() ?? new(),
tagList: [Utils.redisAnagGruppi]
);
}