65ed2bb93a
- Aggiunto metodo GetCredentialIdByNameAsync in CredentialService per recuperare ID credenziali per nome - Implementata gestione robusta dei profili duplicati con riattivazione, sovrascrittura e auto-rinomina - Migliorata logica di caricamento profili con simulazione workflow utente e logging dettagliato - Fixata gestione errori UNIQUE constraint nel salvataggio profili - Aggiunto supporto per salvataggio ID credenziali reali invece di placeholder - Implementato metodo GetProfileByNameIncludingInactiveAsync per gestire profili inattivi - Aggiunto logging esteso per debug e troubleshooting - Integrato componente ProfileSaver nella UI principale - Risolti errori di compilazione e validazione build completa - Migliorata gestione errori con feedback utente per credenziali/entità mancanti
80 lines
2.1 KiB
C#
80 lines
2.1 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
namespace CredentialManager.Models;
|
|
|
|
/// <summary>
|
|
/// Modello per salvare le configurazioni dei profili di Data Coupler
|
|
/// </summary>
|
|
public class DataCouplerProfile
|
|
{
|
|
[Key]
|
|
public int Id { get; set; }
|
|
|
|
[Required]
|
|
[MaxLength(100)]
|
|
public string Name { get; set; } = string.Empty;
|
|
|
|
[MaxLength(500)]
|
|
public string? Description { get; set; }
|
|
|
|
// Configurazione Fonte Dati
|
|
[Required]
|
|
[MaxLength(20)]
|
|
public string SourceType { get; set; } = string.Empty; // "database" o "file"
|
|
|
|
public int? SourceCredentialId { get; set; }
|
|
|
|
[MaxLength(200)]
|
|
public string? SourceSchema { get; set; }
|
|
|
|
[MaxLength(200)]
|
|
public string? SourceTable { get; set; }
|
|
|
|
[MaxLength(500)]
|
|
public string? SourceFilePath { get; set; }
|
|
|
|
// Configurazione Destinazione
|
|
[Required]
|
|
[MaxLength(20)]
|
|
public string DestinationType { get; set; } = string.Empty; // "database" o "rest"
|
|
|
|
public int? DestinationCredentialId { get; set; }
|
|
|
|
[MaxLength(200)]
|
|
public string? DestinationSchema { get; set; }
|
|
|
|
[MaxLength(200)]
|
|
public string? DestinationTable { get; set; }
|
|
|
|
[MaxLength(500)]
|
|
public string? DestinationEndpoint { get; set; }
|
|
|
|
// Mapping dei campi salvato come JSON
|
|
[MaxLength(4000)]
|
|
public string? FieldMappingJson { get; set; }
|
|
|
|
// Configurazione chiave sorgente e associazioni
|
|
[MaxLength(200)]
|
|
public string? SourceKeyField { get; set; }
|
|
|
|
public bool UseRecordAssociations { get; set; } = false;
|
|
|
|
// Metadati
|
|
[MaxLength(100)]
|
|
public string? CreatedBy { get; set; }
|
|
|
|
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
|
|
|
public DateTime? LastUsedAt { get; set; }
|
|
|
|
public bool IsActive { get; set; } = true;
|
|
|
|
// Relazioni opzionali con le credenziali
|
|
[ForeignKey(nameof(SourceCredentialId))]
|
|
public virtual CredentialEntity? SourceCredential { get; set; }
|
|
|
|
[ForeignKey(nameof(DestinationCredentialId))]
|
|
public virtual CredentialEntity? DestinationCredential { get; set; }
|
|
}
|