feat: Implementa gestione intelligente della chiave sorgente con rilevamento PK
- Aggiunge rilevamento automatico Primary Key per connessioni database - Rimuove completamente il fallback automatico per lato sorgente - Implementa selezione manuale obbligatoria per file e sorgenti non-DB - Migliora UI con suggerimenti intelligenti e feedback visivo - Aggiunge validazione multi-livello (UI, pre-transfer, runtime) - Introduce metodo GetPrimaryKeyFieldAsync in IDatabaseManager - Modifica GenerateSourceKey per richiedere sempre campo specifico - Implementa controllo IsTransferButtonEnabled per validazione form Breaking changes: - La generazione automatica delle chiavi sorgente è stata rimossa - Il campo chiave sorgente è ora obbligatorio quando si usa il sistema associazioni Fixes: Risolve problema di discovery schema vuoto con selezione database
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace CredentialManager.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Entità per memorizzare le associazioni tra record sorgente e destinazione
|
||||
/// </summary>
|
||||
public class RecordAssociation
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Nome della sorgente dati (nome tabella/file/foglio)
|
||||
/// </summary>
|
||||
[Required]
|
||||
[MaxLength(200)]
|
||||
public string SourceName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Tipo di sorgente (database, file)
|
||||
/// </summary>
|
||||
[Required]
|
||||
[MaxLength(50)]
|
||||
public string SourceType { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Chiave del record sorgente (può essere un ID o una combinazione di campi)
|
||||
/// </summary>
|
||||
[Required]
|
||||
[MaxLength(500)]
|
||||
public string SourceKey { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Nome dell'entità di destinazione
|
||||
/// </summary>
|
||||
[Required]
|
||||
[MaxLength(200)]
|
||||
public string DestinationEntity { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// ID del record di destinazione
|
||||
/// </summary>
|
||||
[Required]
|
||||
[MaxLength(200)]
|
||||
public string DestinationId { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Nome della credenziale REST utilizzata
|
||||
/// </summary>
|
||||
[Required]
|
||||
[MaxLength(100)]
|
||||
public string RestCredentialName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Data e ora della creazione dell'associazione
|
||||
/// </summary>
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
/// <summary>
|
||||
/// Data e ora dell'ultimo aggiornamento
|
||||
/// </summary>
|
||||
public DateTime? UpdatedAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indica se l'associazione è ancora attiva
|
||||
/// </summary>
|
||||
public bool IsActive { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Informazioni aggiuntive in formato JSON
|
||||
/// </summary>
|
||||
[MaxLength(2000)]
|
||||
public string? AdditionalInfo { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user