Files
Data-Coupler/CredentialManager/Models/DataCouplerProfileDto.cs
T
Alessio 483eb7b407 Fix: Risolto double-mapping negli External ID Relationships per Salesforce
- Implementata funzionalità completa External ID Relationships nell'interfaccia di mapping
- Corretto bug double-mapping: i campi sorgente usati per External ID non vengono più inclusi nei mapping normali
- Risolto errore MALFORMED_ID causato dall'invio duplicato di campi come proprietà dirette e nested objects
- Implementata logica corretta per relationship names: oggetti standard usano il nome diretto, custom objects usano suffisso __r
- Aggiunta UI a 3 colonne (Object, External ID Field, Source Field) per configurazione External ID Relationships
- Migrazione database per supporto External ID Relationships nei profili
- Aggiornato ProfileSaver.razor.cs per salvare/caricare External ID Relationships
- Aggiornato ScheduledProfileExecutionService.cs per gestire External ID nelle esecuzioni schedulate
- Formato JSON output corretto: { 'Account': { 'CardCode__c': 'V50000' } }

Documentazione: EXTERNAL_ID_RELATIONSHIPS_IMPLEMENTATION.md
2026-02-15 18:44:15 +01:00

103 lines
3.5 KiB
C#

namespace CredentialManager.Models;
/// <summary>
/// DTO per la creazione/aggiornamento di un profilo DataCoupler
/// </summary>
public class DataCouplerProfileDto
{
public int? Id { get; set; }
public string Name { get; set; } = string.Empty;
public string? Description { get; set; }
// Informazioni sorgente
public string SourceType { get; set; } = string.Empty;
public int? SourceCredentialId { get; set; }
public string? SourceCredentialName { get; set; }
public string? SourceDatabaseName { get; set; }
public string? SourceSchema { get; set; }
public string? SourceTable { get; set; }
public string? SourceCustomQuery { get; set; }
public string? SourceFilePath { get; set; }
// Informazioni destinazione
public string DestinationType { get; set; } = string.Empty;
public int? DestinationCredentialId { get; set; }
public string? DestinationCredentialName { get; set; }
public string? DestinationSchema { get; set; }
public string? DestinationTable { get; set; }
public string? DestinationEndpoint { get; set; }
// Mapping dei campi
public List<FieldMappingDto>? FieldMappings { get; set; }
// External ID Relationships per Salesforce
public List<ExternalIdRelationshipDto>? ExternalIdRelationships { get; set; }
// Configurazione chiave sorgente e associazioni
public string? SourceKeyField { get; set; }
public bool UseRecordAssociations { get; set; }
}
/// <summary>
/// DTO per il mapping dei campi
/// </summary>
public class FieldMappingDto
{
public string SourceField { get; set; } = string.Empty;
public string DestinationField { get; set; } = string.Empty;
public string? DataType { get; set; }
public bool IsKey { get; set; }
public bool IsRequired { get; set; }
public string? DefaultValue { get; set; }
public string? Transformation { get; set; }
/// <summary>
/// Lista di relazioni External ID associate a questo campo (per Salesforce)
/// </summary>
public List<ExternalIdRelationshipDto>? ExternalIdRelationships { get; set; }
}
/// <summary>
/// DTO per External ID Relationship (Salesforce)
/// </summary>
public class ExternalIdRelationshipDto
{
/// <summary>
/// Nome della relazione (es. "Account__r")
/// </summary>
public string RelationshipName { get; set; } = string.Empty;
/// <summary>
/// Nome dell'oggetto correlato (es. "Account")
/// </summary>
public string RelatedObjectName { get; set; } = string.Empty;
/// <summary>
/// Campo External ID dell'oggetto correlato (es. "Country__c")
/// </summary>
public string ExternalIdField { get; set; } = string.Empty;
/// <summary>
/// Campo sorgente da cui prendere il valore per l'External ID
/// </summary>
public string SourceField { get; set; } = string.Empty;
}
/// <summary>
/// DTO per la visualizzazione di un profilo nella lista
/// </summary>
public class DataCouplerProfileSummaryDto
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public string? Description { get; set; }
public string SourceType { get; set; } = string.Empty;
public string? SourceName { get; set; }
public string DestinationType { get; set; } = string.Empty;
public string? DestinationName { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime? LastUsedAt { get; set; }
public string? CreatedBy { get; set; }
public bool IsActive { get; set; }
}