Architektur

5-Schichten-Modell

graph TD GUI["GUI
Main, Wizard Steps, MessageLog,
DiffFrame, MappingPane, FKResolver
"] ENGINE["Engine
Mapping, SqlBuilder, Sync,
AuditLog, Crypto, FillBack
"] OUTLOOK["Outlook
COM-Abstraktion,
ContactItem, UserProperties
"] DAL["DAL
DB-Zugriff
(ODBC / SQLDB)
"] TYPES["Types
Records, Enums, Interfaces,
Resourcestrings
"] GUI --> ENGINE GUI --> OUTLOOK GUI --> DAL ENGINE --> OUTLOOK ENGINE --> DAL ENGINE --> TYPES OUTLOOK --> TYPES DAL --> TYPES GUI --> TYPES style TYPES fill:#e8f5e9,stroke:#4caf50 style DAL fill:#e3f2fd,stroke:#2196f3 style OUTLOOK fill:#e3f2fd,stroke:#2196f3 style ENGINE fill:#fff3e0,stroke:#ff9800 style GUI fill:#fce4ec,stroke:#e91e63

Abhängigkeitsregeln

  • Types darf NIE GUI, Engine, DAL oder Outlook importieren.
  • Engine darf NIE GUI importieren.
  • DAL und Outlook sind Peers auf derselben Ebene.

Unit-Übersicht pro Schicht

Types (ZERO project-internal deps)

Unit Inhalt
OutlookSync.Types.pas Records (TFieldMapping, TTableRelation, TMappingConfig), Enums (TFieldMappingSource, TSyncDirection, TConflictPolicy, TDeletePolicy, TDiffStatus), Resourcestrings

DAL

Unit Inhalt
OutlookSync.DAL.pas ODBC-Verbindung, parametrisierte Queries, Schema-Abfragen (Tabellen, Spalten, FK-Constraints)

Outlook

Unit Inhalt
OutlookSync.Outlook.pas COM-Wrapper (TOutlookApplication, TOutlookContactItem), Store/Folder-Navigation, UserProperties-API

Engine

Unit Inhalt
OutlookSync.Mapping.pas JSON-Serialisierung (TMappingConfig ↔ JSON), Validierung, Laden/Speichern
OutlookSync.SqlBuilder.pas SELECT/INSERT/UPDATE-Generierung, Alias-Konventionen, IsValidIdent, QuoteIdent
OutlookSync.Sync.pas Diff-Algorithmus, Match-Key-Vergleich, Einzel-/Massen-/Bidir-Sync
OutlookSync.FillBack.pas PK-Retrieval (OUTPUT INSERTED), bidirektionales Fill-Back nach INSERT
OutlookSync.Crypto.pas DPAPI-Wrapper (CryptProtectData/CryptUnprotectData), SecureZeroString
OutlookSync.AuditLog.pas Audit-Trail mit SHA-1-Hashkette, TOutlookSyncAudit.Log()
OutlookSync.SyncState.pas Persistenter Sync-State (DB-PK ↔ Outlook-EntryID, SHA-1-Feldhashes für Änderungs-/Löscherkennung)

GUI

Unit Inhalt
OutlookSync.Main.pas VSCode-Shell (integrierte Titelleiste, Menu, Tabs, Dock-Panes)
OutlookSync.DiffFrame.pas Diff-Grid mit zweizeiligem Layout, Farbcodierung, Filter
OutlookSync.MappingPane.pas 3-Zonen-Designer (Step-Tree, Dependency-Tree, PropertyGrid)
OutlookSync.FKResolver.pas FK-Resolver-Dialog (Suchfeld, Grid, Bulk-Optionen)
OutlookSync.MessageLog.pas Meldungsprotokoll (Grid + Detail-Tab)

Namenskonventionen

Element Prefix Beispiel
Private Felder F FMappings, FCachedRootCols
Parameter A AMapping, ALimit, AJoinColumn
Property (keins) Mapping, Engine
Resourcestrings SBtn/SMsg/SErr/SLbl SErrNoFieldMapped
Klassen T TOutlookSyncEngine
Interfaces I ISyncCallback

Funktionsdesign (12-14-40 SoC)

Metrik Ideal Maximum Aktion bei Überschreitung
Funktionslänge 12–14 Zeilen 40 Zeilen Extrahiere Hilfsfunktion
Parameter 3–4 7 Gruppiere in Record
Verantwortung Single Responsibility Trenne in eigene Methode
Benennung Verb-first Build, Find, Validate, Emit

Wolfgang van der Stille @ EMSR DATA d.o.o. — Outlook Sync

Zuletzt geändert: den 19.02.2026 um 21:54