04f0403f12
BREAKING CHANGE: Rimosso completamente il vecchio sistema RecordAssociation Modifiche principali: - Sostituito RecordAssociation con KeyAssociation basato sui valori delle chiavi - Implementata logica robusta di UPDATE vs INSERT basata su associazioni esistenti - Aggiunta normalizzazione delle chiavi (.Trim()) per consistenza - Implementato fallback nella ricerca associazioni per maggiore affidabilità - Sostituita verifica pre-UPDATE con tentativo diretto più efficiente Componenti modificati: - Nuovo modello: KeyAssociation.cs con campi ottimizzati - Nuovo servizio: KeyAssociationService.cs con metodi completi - Aggiornato: DataCoupler.razor con logica migliorata di gestione associazioni - Aggiornato: CredentialDbContext per gestire solo KeyAssociations - Aggiornati: tutti i servizi di interfaccia per supportare il nuovo sistema - Creata: pagina KeyAssociations.razor per gestione associazioni - Aggiornato: NavMenu.razor con link alla gestione associazioni Miglioramenti tecnici: - Logica di UPDATE più robusta: tenta direttamente l'aggiornamento invece di verificare prima l'esistenza - Gestione errori migliorata con cleanup automatico delle associazioni non valide - Debug logging estensivo per troubleshooting - Fallback nella ricerca associazioni se parametri specifici falliscono - Normalizzazione valori chiave per prevenire problemi di whitespace Risultato: Il sistema ora previene correttamente i duplicati utilizzando le associazioni per decidere se fare INSERT (nuovo record) o UPDATE (record esistente) basandosi sui valori delle chiavi. Database: - Creata migrazione EF per rimuovere RecordAssociations e aggiungere KeyAssociations - Eliminati file e codice legacy non più necessari
212 lines
7.2 KiB
C#
212 lines
7.2 KiB
C#
// <auto-generated />
|
|
using System;
|
|
using CredentialManager.Data;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
|
|
#nullable disable
|
|
|
|
namespace CredentialManager.Migrations
|
|
{
|
|
[DbContext(typeof(CredentialDbContext))]
|
|
[Migration("20250629181214_ReplaceRecordAssociationsWithKeyAssociations")]
|
|
partial class ReplaceRecordAssociationsWithKeyAssociations
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
{
|
|
#pragma warning disable 612, 618
|
|
modelBuilder.HasAnnotation("ProductVersion", "9.0.6");
|
|
|
|
modelBuilder.Entity("CredentialManager.Models.CredentialEntity", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<string>("AdditionalParameters")
|
|
.HasMaxLength(2000)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<int>("CommandTimeout")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("INTEGER")
|
|
.HasDefaultValue(30);
|
|
|
|
b.Property<string>("ConnectionString")
|
|
.HasMaxLength(500)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<string>("CreatedBy")
|
|
.HasMaxLength(100)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<string>("DatabaseName")
|
|
.HasMaxLength(100)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<string>("DatabaseType")
|
|
.HasMaxLength(50)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<string>("EncryptedApiKey")
|
|
.HasMaxLength(500)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<string>("EncryptedAuthToken")
|
|
.HasMaxLength(500)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<string>("EncryptedPassword")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<string>("Headers")
|
|
.HasMaxLength(2000)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<string>("Host")
|
|
.HasMaxLength(200)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<bool>("IgnoreSslErrors")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("INTEGER")
|
|
.HasDefaultValue(false);
|
|
|
|
b.Property<bool>("IsActive")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("INTEGER")
|
|
.HasDefaultValue(true);
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<int?>("Port")
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<string>("RestServiceType")
|
|
.HasMaxLength(50)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<int>("TimeoutSeconds")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("INTEGER")
|
|
.HasDefaultValue(100);
|
|
|
|
b.Property<string>("Type")
|
|
.IsRequired()
|
|
.HasMaxLength(50)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<DateTime?>("UpdatedAt")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<string>("Username")
|
|
.HasMaxLength(100)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("DatabaseType");
|
|
|
|
b.HasIndex("IsActive");
|
|
|
|
b.HasIndex("Name")
|
|
.IsUnique();
|
|
|
|
b.HasIndex("Type");
|
|
|
|
b.ToTable("Credentials", (string)null);
|
|
});
|
|
|
|
modelBuilder.Entity("CredentialManager.Models.KeyAssociation", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("INTEGER");
|
|
|
|
b.Property<string>("AdditionalInfo")
|
|
.HasMaxLength(2000)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<DateTime>("CreatedAt")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<string>("DestinationEntity")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<string>("DestinationId")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<string>("DestinationKeyField")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<bool>("IsActive")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("INTEGER")
|
|
.HasDefaultValue(true);
|
|
|
|
b.Property<string>("KeyValue")
|
|
.IsRequired()
|
|
.HasMaxLength(500)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<DateTime?>("LastVerifiedAt")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<string>("RestCredentialName")
|
|
.IsRequired()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<string>("SourceKeyField")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<string>("SourcesInfo")
|
|
.HasMaxLength(2000)
|
|
.HasColumnType("TEXT");
|
|
|
|
b.Property<DateTime?>("UpdatedAt")
|
|
.HasColumnType("TEXT");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("CreatedAt");
|
|
|
|
b.HasIndex("DestinationEntity");
|
|
|
|
b.HasIndex("IsActive");
|
|
|
|
b.HasIndex("KeyValue")
|
|
.HasDatabaseName("IX_KeyAssociations_KeyValue");
|
|
|
|
b.HasIndex("LastVerifiedAt");
|
|
|
|
b.HasIndex("RestCredentialName");
|
|
|
|
b.HasIndex("KeyValue", "DestinationEntity", "RestCredentialName")
|
|
.IsUnique()
|
|
.HasDatabaseName("IX_KeyAssociations_Unique");
|
|
|
|
b.ToTable("KeyAssociations", (string)null);
|
|
});
|
|
#pragma warning restore 612, 618
|
|
}
|
|
}
|
|
}
|