originalRecord, string entityId, string newDataHash)
+ {
+ try
+ {
+ // Cattura i valori condivisi per evitare race conditions
+ var currentEntityName = selectedRestEntity?.Name ?? "";
+ var currentCredentialName = selectedRestCredential ?? "";
+
+ var sourceKey = GenerateSourceKey(originalRecord);
+ if (string.IsNullOrEmpty(sourceKey)) return;
+
+ // Trova l'associazione esistente e aggiorna l'hash
+ var existingAssociation = await CredentialService.FindKeyAssociationByValueParallelAsync(
+ sourceKey, currentEntityName, currentCredentialName);
+
+ if (existingAssociation != null)
+ {
+ existingAssociation.Data_Hash = newDataHash;
+ existingAssociation.LastVerifiedAt = DateTime.UtcNow;
+ existingAssociation.UpdatedAt = DateTime.UtcNow;
+
+ await CredentialService.UpdateKeyAssociationAsync(existingAssociation);
+ Logger.LogDebug("COMPOSITE: Hash associazione aggiornato per entityId {EntityId} - Nuovo hash: {Hash}",
+ entityId, newDataHash);
+ }
+ else
+ {
+ Logger.LogWarning("COMPOSITE: Associazione non trovata per aggiornamento hash - EntityId: {EntityId}, SourceKey: {SourceKey}",
+ entityId, sourceKey);
+ }
+ }
+ catch (Exception ex)
+ {
+ Logger.LogWarning(ex, "Errore nell'aggiornamento dell'hash dell'associazione per entityId {EntityId}", entityId);
+ }
+ }
+
private Task UpdateAssociationVerificationAsync(string entityId)
{
try
@@ -2840,7 +2956,7 @@ public partial class DataCoupler : ComponentBase
}
}
- private void ShowTransferResults(int successCount, int updatedCount, int duplicateCount, int errorCount)
+ private void ShowTransferResults(int successCount, int updatedCount, int duplicateCount, int errorCount, int skippedCount = 0)
{
if (errorCount == 0)
{
@@ -2849,6 +2965,7 @@ public partial class DataCoupler : ComponentBase
if (successCount > 0) messageParts.Add($"{successCount} record inseriti");
if (updatedCount > 0) messageParts.Add($"{updatedCount} record aggiornati");
+ if (skippedCount > 0) messageParts.Add($"{skippedCount} record saltati (dati non modificati)");
if (duplicateCount > 0) messageParts.Add($"{duplicateCount} duplicati rilevati (warning)");
message += string.Join(", ", messageParts) + ".";
@@ -2862,6 +2979,7 @@ public partial class DataCoupler : ComponentBase
if (successCount > 0) messageParts.Add($"Inserimenti: {successCount}");
if (updatedCount > 0) messageParts.Add($"Aggiornamenti: {updatedCount}");
+ if (skippedCount > 0) messageParts.Add($"Saltati: {skippedCount}");
if (duplicateCount > 0) messageParts.Add($"Duplicati (warning): {duplicateCount}");
messageParts.Add($"Errori: {errorCount}");
diff --git a/Data_Coupler/Pages/KeyAssociations.razor b/Data_Coupler/Pages/KeyAssociations.razor
index 54452e9..f9d9992 100644
--- a/Data_Coupler/Pages/KeyAssociations.razor
+++ b/Data_Coupler/Pages/KeyAssociations.razor
@@ -242,6 +242,7 @@
| Entità Destinazione |
ID Destinazione |
Credenziale |
+ Hash Dati |
Stato |
Creata |
Verificata |
@@ -270,6 +271,20 @@
@association.RestCredentialName
|
+
+ @if (!string.IsNullOrEmpty(association.Data_Hash))
+ {
+
+ @(association.Data_Hash.Substring(0, Math.Min(12, association.Data_Hash.Length)))...
+
+ }
+ else
+ {
+
+ Non disponibile
+
+ }
+ |
@if (association.IsActive)
{
|