82ac7df0ec
- IDataSourceAdapter mit 3 Implementierungen (HANA, SAP_GATEWAY, MANUAL_EXCEL) und DataSourceAdapterResolver ersetzen das if/else auf ConnectionKind. - SiteExportService von 338 auf 187 Zeilen reduziert: Pipeline Resolve -> Fetch -> Transform -> Excel -> Central -> SharePoint. - Page-Services auf Scoped (per Blazor-Circuit); Orchestrator bleibt Singleton fuer geteilten Export-Status.
28 lines
882 B
C#
28 lines
882 B
C#
using TrafagSalesExporter.Models;
|
|
|
|
namespace TrafagSalesExporter.Services.DataSources;
|
|
|
|
public sealed class DataSourceAdapterResolver : IDataSourceAdapterResolver
|
|
{
|
|
private readonly Dictionary<string, IDataSourceAdapter> _adapters;
|
|
|
|
public DataSourceAdapterResolver(IEnumerable<IDataSourceAdapter> adapters)
|
|
{
|
|
_adapters = adapters.ToDictionary(
|
|
a => a.ConnectionKind,
|
|
StringComparer.OrdinalIgnoreCase);
|
|
}
|
|
|
|
public IDataSourceAdapter Resolve(string connectionKind)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(connectionKind))
|
|
connectionKind = SourceSystemConnectionKinds.Hana;
|
|
|
|
if (_adapters.TryGetValue(connectionKind, out var adapter))
|
|
return adapter;
|
|
|
|
throw new InvalidOperationException(
|
|
$"Kein DataSourceAdapter fuer ConnectionKind '{connectionKind}' registriert.");
|
|
}
|
|
}
|