MappingEngine

Classes > Sync > MappingEngine

Engine for applying data mappings to sync log entries. Implements spec Section 7 - Data Mapping.

public static class MappingEngine

Methods

ApplyMapping(SyncLogEntry, SyncMappingConfig, MappingDirection, ILogger)

public static MappingResult ApplyMapping(SyncLogEntry entry, SyncMappingConfig config, MappingDirection direction, ILogger logger)

Applies mapping configuration to a sync log entry. Per spec Section 7.5.3 - Sync Decision Logic.

Parameters:

Name Type Description
entry SyncLogEntry Sync log entry to map.
config SyncMappingConfig Mapping configuration.
direction MappingDirection Current sync direction.
logger ILogger Logger for diagnostics.

Returns: MappingResult - Mapping result.

FindMapping(string, SyncMappingConfig, MappingDirection)

public static TableMapping? FindMapping(string tableName, SyncMappingConfig config, MappingDirection direction)

Finds the mapping for a table and direction.

Parameters:

Name Type Description
tableName String Source table name.
config SyncMappingConfig Mapping configuration.
direction MappingDirection Sync direction.

Returns: TableMapping - Matching mapping or null.

MapPrimaryKey(string, PkMapping?)

public static string MapPrimaryKey(string sourcePk, PkMapping? pkMapping)

Maps a primary key value using PK mapping configuration.

Parameters:

Name Type Description
sourcePk String Source PK JSON, e.g. {"Id": "uuid"}.
pkMapping PkMapping PK mapping configuration.

Returns: String - Mapped PK JSON.