[Feature] Aggiunto supporto completo OLE DB per connessione database

## Nuovi file
- DataConnection/DB/OleDbDatabaseManager.cs: Manager completo per connessioni OLE DB
  con supporto Task.Run() per operazioni sincrone, parametri posizionali '?',
  guard per piattaforma Windows, nessun supporto ChangeDatabaseAsync (no-op)
- DataConnection/DB/EF/SchemaProviders/OleDbSchemaProvider.cs: Schema provider per
  OLE DB, usa OleDbSchemaGuid per tabelle/colonne/chiavi primarie, mapping tipi dati
- CredentialManager/Services/OleDbProviderDiscoveryService.cs: Servizio di discovery
  provider OLE DB installati tramite registro Windows (HKEY_CLASSES_ROOT). Rileva
  9 provider noti: VFPOLEDB.1, Microsoft.ACE.OLEDB.12.0, Jet 4.0, SQLOLEDB, ecc.
  Mostra warning per provider solo 32-bit (VFPOLEDB, Jet)
- PUBLISH_32BIT_64BIT.md: Documentazione completa comandi pubblicazione per
  win-x64, win-x86 (richiesto per VFP), linux-x64, osx-x64, osx-arm64.
  Include prerequisiti VFPOLEDB, esempi connection string VFP, note Docker

## File modificati
- DataConnection/DB/Enums/DatabaseType.cs: Aggiunto valore OleDb dopo Odbc
- DataConnection/DataConnection.csproj: Aggiunto pacchetto System.Data.OleDb 9.0.3
- DataConnection/DB/OdbcDatabaseManager.cs: Fix bug ChangeDatabaseAsync con try-catch
- CredentialManager/Models/CredentialModels.cs: Aggiunto OleDb all'enum DatabaseType,
  BuildOleDbConnectionString() con supporto provider da AdditionalParameters,
  default VFPOLEDB.1, costruzione connection string con parametri VFP
- DataConnection/CredentialManagement/Models/CredentialExtensions.cs: Mappatura
  OleDb in ToDataConnectionDatabaseType() e ToCredentialDatabaseType()
- DataConnection/CredentialManagement/Services/DataConnectionCredentialService.cs:
  Aggiunto case OleDb in TestDatabaseConnectionAsync e metodo TestOleDbConnection()
  con apertura connessione via Task.Run() e gestione OleDbException dettagliata
- Data_Coupler/Services/DataConnectionFactory.cs: Aggiunto case OleDb per creazione
  OleDbDatabaseManager
- Data_Coupler/Program.cs: Registrazione IOleDbProviderDiscoveryService come Scoped
- Data_Coupler/Pages/CredentialManagement.razor: Aggiunta UI completa OLE DB con
  sezione dedicata Visual FoxPro (percorso .dbc/.dbf, Collating Sequence, DELETED),
  provider discovery con refresh, anteprima connection string, variabili di stato
  e metodi nel codice Blazor, sincronizzazione AdditionalParameters al salvataggio

## Compatibilità
- VFP 8.0/9.0: testato con VFPOLEDB.1, connessione file-based .dbc e .dbf
- Richiede pubblicazione win-x86 per driver OLE DB 32-bit
- AnyCPU non supportato per VFP (COM 32-bit)
This commit is contained in:
2026-05-25 21:20:08 +02:00
parent 6452d45b77
commit 82e0d6bc77
13 changed files with 1342 additions and 5 deletions
@@ -251,6 +251,7 @@ public class DataConnectionCredentialService : IDataConnectionCredentialService
CredentialManager.Models.DatabaseType.Oracle => await TestOracleConnection(connectionString, credential),
CredentialManager.Models.DatabaseType.Sqlite => await TestSqliteConnection(connectionString, credential),
CredentialManager.Models.DatabaseType.Odbc => await TestOdbcConnection(connectionString, credential),
CredentialManager.Models.DatabaseType.OleDb => await TestOleDbConnection(connectionString, credential),
_ => (false, $"Test di connessione non implementato per {credential.DatabaseType}")
};
}
@@ -404,6 +405,46 @@ public class DataConnectionCredentialService : IDataConnectionCredentialService
}
}
private async Task<(bool Success, string Message)> TestOleDbConnection(string connectionString, DatabaseCredential credential)
{
try
{
using var connection = new System.Data.OleDb.OleDbConnection(connectionString);
await Task.Run(() => connection.Open());
var details = new System.Text.StringBuilder();
details.AppendLine("Connessione OLE DB stabilita con successo!");
details.AppendLine();
details.AppendLine("Dettagli:");
details.AppendLine($"- Provider: {connection.Provider}");
if (!string.IsNullOrEmpty(connection.Database))
details.AppendLine($"- Database: {connection.Database}");
if (!string.IsNullOrEmpty(credential.DatabaseName))
details.AppendLine($"- Data Source: {credential.DatabaseName}");
details.AppendLine($"- Timeout: {credential.CommandTimeout}s");
return (true, details.ToString());
}
catch (System.Data.OleDb.OleDbException oleDbEx)
{
var errorDetails = new System.Text.StringBuilder();
errorDetails.AppendLine($"Errore OLE DB: {oleDbEx.Message}");
errorDetails.AppendLine();
errorDetails.AppendLine("Dettagli errori:");
foreach (System.Data.OleDb.OleDbError error in oleDbEx.Errors)
{
errorDetails.AppendLine($"- [{error.SQLState}] {error.Message}");
errorDetails.AppendLine($" Source: {error.Source}");
}
return (false, errorDetails.ToString());
}
catch (Exception ex)
{
return (false, $"Errore OLE DB: {ex.Message}");
}
}
public async Task<(bool Success, string Message)> TestRestApiConnectionAsync(string credentialName)
{
try