feat: Aggiunto sistema completo di gestione profili per Data Coupler
- Creata nuova libreria Components con componenti Blazor riutilizzabili * ProfileSelector: dropdown per selezione profili salvati * ProfileSaver: componente per salvare configurazioni correnti come profili * ProfileManagement: modale per gestione profili salvati * ProfileQuickActions: bottoni azioni rapide per operazioni sui profili - Esteso CredentialManager con entità e servizi per DataCouplerProfile * Aggiunto modello DataCouplerProfile con configurazioni mapping e metadati * Implementata migrazione Entity Framework per memorizzazione profili * Creato DataCouplerProfileService per operazioni CRUD * Aggiunto CredentialDbContextFactory per operazioni database design-time - Migliorato componente principale DataCoupler con integrazione profili * Integrata funzionalità caricamento/salvataggio profili * Aggiunto selettore profili nella parte superiore dell'interfaccia * Mantenuta retrocompatibilità con funzionalità esistenti * Migliorata esperienza utente con gestione configurazioni salvate - Aggiornata struttura progetto e dipendenze * Aggiunto progetto Components alla soluzione * Aggiornati riferimenti progetti e import * Rimosso progetto obsoleto TestDatabaseFix Questo aggiornamento migliora significativamente il flusso di lavoro permettendo agli utenti di salvare, caricare e gestire configurazioni complete di accoppiamento dati come
This commit is contained in:
@@ -10,6 +10,7 @@ public class CredentialDbContext : DbContext
|
||||
{
|
||||
public DbSet<CredentialEntity> Credentials { get; set; }
|
||||
public DbSet<KeyAssociation> KeyAssociations { get; set; }
|
||||
public DbSet<DataCouplerProfile> DataCouplerProfiles { get; set; }
|
||||
|
||||
public CredentialDbContext(DbContextOptions<CredentialDbContext> options) : base(options)
|
||||
{
|
||||
@@ -141,5 +142,80 @@ public class CredentialDbContext : DbContext
|
||||
entity.HasIndex(e => e.CreatedAt);
|
||||
entity.HasIndex(e => e.LastVerifiedAt);
|
||||
});
|
||||
|
||||
// Configurazione della tabella DataCouplerProfiles
|
||||
modelBuilder.Entity<DataCouplerProfile>(entity =>
|
||||
{
|
||||
entity.ToTable("DataCouplerProfiles");
|
||||
|
||||
entity.HasKey(e => e.Id);
|
||||
|
||||
entity.Property(e => e.Name)
|
||||
.IsRequired()
|
||||
.HasMaxLength(100);
|
||||
|
||||
entity.Property(e => e.Description)
|
||||
.HasMaxLength(500);
|
||||
|
||||
entity.Property(e => e.SourceType)
|
||||
.IsRequired()
|
||||
.HasMaxLength(20);
|
||||
|
||||
entity.Property(e => e.SourceSchema)
|
||||
.HasMaxLength(200);
|
||||
|
||||
entity.Property(e => e.SourceTable)
|
||||
.HasMaxLength(200);
|
||||
|
||||
entity.Property(e => e.SourceFilePath)
|
||||
.HasMaxLength(500);
|
||||
|
||||
entity.Property(e => e.DestinationType)
|
||||
.IsRequired()
|
||||
.HasMaxLength(20);
|
||||
|
||||
entity.Property(e => e.DestinationSchema)
|
||||
.HasMaxLength(200);
|
||||
|
||||
entity.Property(e => e.DestinationTable)
|
||||
.HasMaxLength(200);
|
||||
|
||||
entity.Property(e => e.DestinationEndpoint)
|
||||
.HasMaxLength(500);
|
||||
|
||||
entity.Property(e => e.FieldMappingJson)
|
||||
.HasMaxLength(4000);
|
||||
|
||||
entity.Property(e => e.CreatedBy)
|
||||
.HasMaxLength(100);
|
||||
|
||||
// Valori di default
|
||||
entity.Property(e => e.CreatedAt)
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
|
||||
entity.Property(e => e.IsActive)
|
||||
.HasDefaultValue(true);
|
||||
|
||||
// Indici
|
||||
entity.HasIndex(e => e.Name)
|
||||
.IsUnique();
|
||||
|
||||
entity.HasIndex(e => e.SourceType);
|
||||
entity.HasIndex(e => e.DestinationType);
|
||||
entity.HasIndex(e => e.IsActive);
|
||||
entity.HasIndex(e => e.CreatedAt);
|
||||
entity.HasIndex(e => e.LastUsedAt);
|
||||
|
||||
// Relazioni con le credenziali
|
||||
entity.HasOne(e => e.SourceCredential)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.SourceCredentialId)
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
entity.HasOne(e => e.DestinationCredential)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.DestinationCredentialId)
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Design;
|
||||
|
||||
namespace CredentialManager.Data;
|
||||
|
||||
/// <summary>
|
||||
/// Factory per creare il DbContext durante la fase di design (migrations)
|
||||
/// </summary>
|
||||
public class CredentialDbContextFactory : IDesignTimeDbContextFactory<CredentialDbContext>
|
||||
{
|
||||
public CredentialDbContext CreateDbContext(string[] args)
|
||||
{
|
||||
var optionsBuilder = new DbContextOptionsBuilder<CredentialDbContext>();
|
||||
|
||||
// Usa un database SQLite temporaneo per le migrations
|
||||
var connectionString = "Data Source=design_time_temp.db";
|
||||
optionsBuilder.UseSqlite(connectionString);
|
||||
|
||||
return new CredentialDbContext(optionsBuilder.Options);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user