DataSourceAdapter-Pattern + SiteExportService schlanker + Page-Services Scoped

- 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.
This commit is contained in:
Claude
2026-04-17 12:11:35 +00:00
parent 2a56ba53ba
commit 82ac7df0ec
11 changed files with 431 additions and 231 deletions
@@ -0,0 +1,27 @@
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.");
}
}