fix: Risolto errore "Invalid object name" nel trasferimento dati e pulizia codice
- Modificato GetAllRecordsAsync per utilizzare la stessa connection string del discovery schema - Aggiunto metodo CreateConnection per creare connessioni DB appropriate per tipo - Migliorata gestione nomi tabelle con schema (es. "dbo.OCRD") - Rimossi metodi obsoleti di creazione entità (UpdateEntityData, CreateNewEntity) - Eliminati riferimenti a variabili non dichiarate (newEntityData, isCreatingEntity) - Aggiunto logging debug per connection string e query SQL - Completata implementazione trasferimento dati da database a REST API Il trasferimento dati ora utilizza la stessa connessione per discovery e estrazione, risolvendo problemi di accesso alle tabelle durante l'operazione di upsert.
This commit is contained in:
@@ -540,6 +540,28 @@ namespace DataConnection.REST.Implementations
|
||||
}
|
||||
|
||||
return null;
|
||||
} /// <summary>
|
||||
/// Authenticates with SAP B1 Service Layer using the credentials from options.
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">Cancellation token</param>
|
||||
/// <returns>True if authentication is successful</returns>
|
||||
public override async Task<bool> AuthenticateAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (string.IsNullOrEmpty(_options.Username) || string.IsNullOrEmpty(_options.Password))
|
||||
{
|
||||
Console.WriteLine("SAP B1 authentication requires username and password in options");
|
||||
return false;
|
||||
}
|
||||
|
||||
// For SAP B1, we also need the company database name
|
||||
// We'll check multiple fields for the company DB name
|
||||
var companyDB = !string.IsNullOrEmpty(_options.ApiKey) ? _options.ApiKey :
|
||||
!string.IsNullOrEmpty(_options.AuthToken) ? _options.AuthToken :
|
||||
"SBODEMOUS"; // Default fallback
|
||||
|
||||
Console.WriteLine($"Using SAP B1 credentials - CompanyDB: {companyDB}, Username: {_options.Username}");
|
||||
|
||||
return await LoginAsync(companyDB, _options.Username, _options.Password, cancellationToken);
|
||||
}
|
||||
|
||||
// Helper to get cookie value
|
||||
|
||||
Reference in New Issue
Block a user