Source files
  • Editor/BeepSync/BeepSyncManager.Core.cs — constructor, properties, dispose
  • Editor/BeepSync/BeepSyncManager.Sync.cs — main SyncDataAsync orchestration
  • Editor/BeepSync/BeepSyncManager.BulkSync.cs — sequential & parallel bulk helpers
  • Editor/BeepSync/BeepSyncManager.Cdc.cs — CDC / watermark filter builder
  • Editor/BeepSync/BeepSyncManager.ConflictResolution.cs — conflict gate & evidence
  • Editor/BeepSync/BeepSyncManager.Preflight.cs — pre-run validation
  • Editor/BeepSync/BeepSyncManager.SchemaManagement.cs — schema CRUD & persistence
  • Editor/BeepSync/BeepSyncManager.RetryCheckpoint.cs — retry classification & checkpoint
  • Editor/BeepSync/BeepSyncManager.SchemaGovernance.cs — promotion gate & versioning
  • Editor/BeepSync/SyncMetrics.cs — metrics model
  • Editor/BeepSync/SyncRuleExecutionPolicies.cs — rule policy profiles
  • Editor/BeepSync/Helpers/*.cs — helper classes
  • Editor/BeepSync/Examples/*.cs — runnable examples

Overview

BeepSyncManager is the modern replacement for the legacy DataSyncManager. It is a partial class split across nine focused files and orchestrates one-way or bidirectional data synchronization between any two registered IDataSource instances.

Folder map

Editor/BeepSync/
  BeepSyncManager.Core.cs              constructor, properties, dispose
  BeepSyncManager.Sync.cs              main SyncDataAsync() pipeline
  BeepSyncManager.BulkSync.cs          SyncAllData*, SyncData overloads
  BeepSyncManager.Cdc.cs               BuildCdcFilterContext()
  BeepSyncManager.ConflictResolution.cs TryEvaluateConflictGate()
  BeepSyncManager.Preflight.cs         RunPreflightAsync()
  BeepSyncManager.SchemaManagement.cs  Add/Remove/Update, Save/Load
  BeepSyncManager.RetryCheckpoint.cs   TryClassifyError, IsCheckpointResumeSafe
  BeepSyncManager.SchemaGovernance.cs  PromoteSchemaAsync()
  SyncMetrics.cs                       metrics/telemetry data model
  SyncRuleExecutionPolicies.cs         DefaultSafe / FastPath profiles
  Interfaces/
    ISyncHelpers.cs                    helper interfaces
  Helpers/
    DataSourceHelper.cs                IDataSource open/get/insert/update
    FieldMappingHelper.cs              AutoMapFields, type conversion
    SyncValidationHelper.cs            schema & watermark validation
    SyncProgressHelper.cs              progress reporting & run history
    SchemaPersistenceHelper.cs         JSON file save/load/backup
  Models/
    CdcFilterContext.cs                CDC filter result envelope
    SyncIntegrationContext.cs          optional rule/defaults/mapping wiring
    SyncPlanMetadata.cs                run-time plan metadata
  Examples/
    Example01_BasicFullSync.cs
    Example02_SchemaVersioning.cs
    Example03_IncrementalSync.cs
    Example04_BidirectionalConflict.cs
    Example05_RetryAndCheckpoint.cs
    Example06_DataQualityAndReconciliation.cs
    Example07_SloAndAlerting.cs
    Example08_PerformanceAndParallel.cs

Key design principles

PrincipleHow it is applied
Single ResponsibilityEach partial file / helper class owns one domain (CDC, conflict, preflight, …)
Async-firstAll long-running operations are async Task with CancellationToken
Rule-engine integrationEvery policy gate (DQ, conflict, retry, promotion) can be overridden by named rules
TestabilityAll helpers are injected via interfaces; the manager accepts mocks transparently
Progress & observabilityIProgress<PassedArgs> propagated at every step; SyncMetrics emitted per run

Migration from DataSyncManager

Old APINew API
SyncData()SyncDataAsync() / SyncData(schemaId)
ValidateSchema()ValidateSchema() (enhanced, returns IErrorsInfo)
SaveSchemas()SaveSchemasAsync() / SaveSchemas()
LoadSchemas()LoadSchemasAsync() / LoadSchemas()

Quick Start

Minimal example — one-way full sync of a Customers table.

// 1. Create the manager
var syncManager = new BeepSyncManager(dmeEditor);

// 2. Describe the sync
var schema = new DataSyncSchema
{
    Id                        = Guid.NewGuid().ToString(),
    SourceDataSourceName      = "SourceDB",
    DestinationDataSourceName = "DestDB",
    SourceEntityName          = "Customers",
    DestinationEntityName     = "Customers",
    SourceKeyField            = "CustomerId",
    DestinationKeyField       = "CustomerId",
    SyncType                  = "Full",       // "Full" | "Incremental"
    SyncDirection             = "OneWay",     // "OneWay" | "Bidirectional"
    BatchSize                 = 500,
};

// 3. Auto-map fields (name matching)
var fieldHelper = new FieldMappingHelper(dmeEditor);
foreach (var m in fieldHelper.AutoMapFields("SourceDB", "Customers", "DestDB", "Customers"))
    schema.MappedFields.Add(m);

// 4. Register & run
syncManager.AddSyncSchema(schema);
var progress = new Progress<PassedArgs>(p => Console.WriteLine(p.Messege));
await syncManager.SyncDataAsync(schema, CancellationToken.None, progress);

// 5. Inspect result
Console.WriteLine($"Status: {schema.SyncStatus}  LastSync: {schema.LastSyncDate:u}");

// 6. Persist
await syncManager.SaveSchemasAsync();

Core API — Constructor & Properties

Constructors

// Minimal — helpers wired internally
BeepSyncManager(IDMEEditor editor)

// With optional rule/defaults integration context
BeepSyncManager(IDMEEditor editor, SyncIntegrationContext integrationContext)

SyncIntegrationContext

When set, unlocks rule-engine gating for every policy decision point.

var ctx = new SyncIntegrationContext
{
    RuleEngine      = myRuleEngine,     // IRuleEngine — drives all rule policy gates
    DefaultsManager = myDefaults,       // IDefaultsManager — fills default field values
    RunInitiatedBy  = "scheduler",      // stamped on schema versions & audit logs
    // MappingPlanState = ...           // optional: shared mapping plan state
};
var syncManager = new BeepSyncManager(editor, ctx);

Properties

PropertyTypeDescription
EditorIDMEEditorData management engine provided at construction
SyncSchemasList<DataSyncSchema>All registered schemas
FilepathstringPath used for schema JSON persistence
IntegrationContextSyncIntegrationContextOptional rule/defaults wiring
LastRunConflictsList<ConflictEvidence>Populated by bidirectional runs when CaptureEvidence = true
LastRunCheckpointSyncCheckpointLatest checkpoint persisted during the last run
LastRunReconciliationReportReconciliationReportDQ reconciliation results from the last run

Schema Management

CRUD methods

// Add a new schema to the in-memory list
syncManager.AddSyncSchema(schema);

// Update an existing schema by Id
syncManager.UpdateSyncSchema(schema);

// Remove by Id
syncManager.RemoveSyncSchema(schemaId);

// Manual schema validation (returns IErrorsInfo)
IErrorsInfo result = syncManager.ValidateSchema(schema);

Filters & field mappings

// Add a filter clause (AppFilter wraps a field/operator/value predicate)
syncManager.AddFilter(schemaId, new AppFilter
{
    FieldName  = "Region",
    Operator   = "=",
    FilterValue = "EU"
});

// Remove a filter by field name
syncManager.RemoveFilter(schemaId, "Region");

// Add a single field mapping
syncManager.AddFieldMapping(schemaId, new FieldSyncData
{
    SourceField      = "CustomerName",
    DestinationField = "Name",
});

Persistence

// Async — preferred
await syncManager.SaveSchemasAsync();
await syncManager.LoadSchemasAsync();

// Sync fallback
syncManager.SaveSchemas();
syncManager.LoadSchemas();

DataSyncSchema — key fields

FieldTypeDescription
IdstringUnique identifier (GUID string)
SourceDataSourceNamestringRegistered name of the source IDataSource
DestinationDataSourceNamestringRegistered name of the destination
SourceEntityNamestringTable / entity in the source
DestinationEntityNamestringTable / entity in the destination
SourceKeyFieldstringPrimary key in the source
DestinationKeyFieldstringPrimary key in the destination
SyncTypestring"Full" or "Incremental"
SyncDirectionstring"OneWay" or "Bidirectional"
BatchSizeintRecords per batch (default 500)
MappedFieldsList<FieldSyncData>Source-to-destination field mappings
FiltersList<AppFilter>Pre-fetch filter predicates
WatermarkPolicyWatermarkPolicyCDC / incremental configuration
ConflictPolicyConflictPolicyBidirectional conflict handling strategy
RetryPolicyRetryPolicyRetry & checkpoint settings
RulePolicySyncRulePolicyGlobal rule-engine on/off flag
SyncStatusstringUpdated after each run ("Success", "Failed", …)
LastSyncDateDateTimeTimestamp of the most recent completed run

SyncDataAsync — Full Orchestration

Signature

Task SyncDataAsync(
    DataSyncSchema         schema,
    CancellationToken      token          = default,
    IProgress<PassedArgs> progress       = null,
    IImportErrorStore      errorStore     = null,
    IImportHistoryStore    historyStore   = null
);

Pipeline steps

When called, SyncDataAsync executes the following ordered pipeline:

#StepWhat happens
1Structural validationValidateSchema — null, missing names, empty mappings
2PreflightRunPreflightAsync — connectivity, rule checks, defaults readiness
3DQ mapping quality gateRule sync.dq.mapping-quality inspects field map completeness (if rules enabled)
4Rule audit telemetryRule sync.audit.pre-run emits tracing metadata
5Performance profileRule sync.perf.profile selects RU/batch tuning values
6Retry / checkpoint loadLoads existing checkpoint from ActiveCheckpoint; classifies last error if any
7CDC filter buildBuildCdcFilterContext — calculates watermark window, filters, late-arrival rule
8ImportDelegates to DataImportManager.RunImportAsync with the CDC-enriched import config
9Bidirectional reverse importIf SyncDirection = "Bidirectional", swaps source ↔ dest and re-imports
10Conflict gateTryEvaluateConflictGate runs built-in or rule-driven resolution; quarantines if required
Cancellation — Pass a CancellationToken from a UI button or scheduler. The sync manager propagates it to RunImportAsync and all awaited helpers. On cancellation the schema SyncStatus is set to "Cancelled".

Bulk Sync

When you have multiple schemas registered, the bulk helpers iterate them in one call.

Sequential

// Async — processes schemas one after another
await syncManager.SyncAllDataAsync(CancellationToken.None, progress);

// Sync fallback
syncManager.SyncAllData();

Parallel

// Runs schemas in parallel, bounded by SyncPerformanceProfile.MaxDegreeOfParallelism
await syncManager.SyncAllDataParallelAsync(CancellationToken.None, progress);

The semaphore count is read from the schema's performance profile rule result (default 4). This avoids overwhelming shared data sources under load.

SyncData overloads (sync, by schema ID)

OverloadNotes
SyncData(string schemaId)Minimal — find schema by ID and run synchronously
SyncData(string schemaId, IProgress<PassedArgs> progress)With progress reporter
SyncData(string schemaId, IProgress<PassedArgs> progress, IImportErrorStore errors)With error store
SyncData(string schemaId, IProgress<PassedArgs> progress, IImportErrorStore e, IImportHistoryStore h)With full history store
SyncData(string schemaId, CancellationToken token, IProgress<PassedArgs> progress)With cancellation
SyncData(string schemaId, CancellationToken token, IProgress<PassedArgs> progress, IImportErrorStore e, IImportHistoryStore h)Full six-arg overload

Preflight Validation

Method

Task<SyncPreflightReport> RunPreflightAsync(
    DataSyncSchema    schema,
    CancellationToken token = default
);

Checks performed

#CheckGate type
1Structural validation — null fields, missing source/dest namesHard fail
2Rule Engine gate — sync.plan.validate (if rules enabled)Soft / configurable
3Defaults profile readiness — IDefaultsManager.IsReadyWarning
4Watermark policy validation — field name set, mode recognisedWarning
5Conflict policy rule existence — if ResolutionRuleKey set, engine must have itWarning

SyncPreflightReport

var report = await syncManager.RunPreflightAsync(schema);

if (!report.IsApproved)
{
    foreach (var issue in report.Issues)
        Console.WriteLine($"[{issue.Severity}] {issue.Code}: {issue.Message}");
    return; // block the run
}

Console.WriteLine($"Rules passed : {report.RulesPassed}");
Console.WriteLine($"Defaults ready: {report.DefaultsReady}");

CDC & Watermark (Incremental Sync)

Set SyncType = "Incremental" and configure WatermarkPolicy to restrict each sync run to only records changed since the previous run.

WatermarkPolicy

schema.WatermarkPolicy = new WatermarkPolicy
{
    WatermarkMode        = "Timestamp",   // "Timestamp" | "Sequence" | "CompositeKey"
    WatermarkField       = "UpdatedAt",   // column that advances monotonically
    LastWatermarkValue   = null,          // null = start from beginning; engine updates this
    OverlapWindowSeconds = 300,           // re-scan last 5 min to catch late arrivals
    DedupeStrategy       = "LastWrite",   // "LastWrite" | "FirstWrite" | "None"
    ReplayEnabled        = true,          // idempotent: safe to re-run the same window

    // Optional: rule keys override the built-in filter/late-arrival logic
    FilterRuleKey        = "sync.watermark.filter",
    LateArrivalRuleKey   = "sync.watermark.late-arrival",
};

WatermarkMode values

ModeTypical field typeUse case
TimestampDateTime / DateTimeOffsetAudit timestamp, UpdatedAt, ModifiedAt
Sequencelong / intAuto-increment IDs, sequence numbers, offsets
CompositeKeyMultiple columnsChange-version tables with composite change keys

CdcFilterContext (output)

Returned by BuildCdcFilterContext — the runtime filter envelope passed to DataImportManager.

FieldTypeDescription
ResolvedFiltersList<AppFilter>Computed filter predicates using the watermark window
WindowStartobjectEffective lower-bound (includes overlap window)
WindowEndobjectEffective upper-bound (current watermark)
NewWatermarkValueobjectValue to be persisted as LastWatermarkValue after a successful run
LateArrivalActionstring"Include" / "Warn" / "Quarantine" per rule result

Conflict Resolution

Applies only when SyncDirection = "Bidirectional". When a record exists in both source and destination with different values, TryEvaluateConflictGate decides which value wins.

ConflictPolicy

schema.ConflictPolicy = new ConflictPolicy
{
    // Built-in rule keys (no rule engine required):
    //   "sync.conflict.source-wins"
    //   "sync.conflict.destination-wins"
    //   "sync.conflict.latest-timestamp-wins"
    //   "sync.conflict.fail-on-conflict"
    ResolutionRuleKey     = "sync.conflict.latest-timestamp-wins",

    CaptureEvidence       = true,    // populate BeepSyncManager.LastRunConflicts

    // Quarantine records whose conflict could not be resolved:
    QuarantineDsName      = "QuarantineDB",
    QuarantineEntity      = "ConflictQuarantine",

    MaxConflictsPerRun    = 500,
    OnMaxExceededAction   = "QuarantineRest",  // "Abort" | "Continue" | "QuarantineRest"
};

Built-in strategies

Rule keyBehaviour
sync.conflict.source-winsSource record always overwrites destination
sync.conflict.destination-winsDestination record is kept unchanged (default fallback)
sync.conflict.latest-timestamp-winsRecord with the later timestamp wins; requires WatermarkField
sync.conflict.fail-on-conflictAny conflict halts the run immediately
(custom key)Rule engine evaluates your custom rule; output must be "source", "destination", or "quarantine"

ConflictEvidence (audit)

// After a bidirectional run:
var conflicts = syncManager.LastRunConflicts;
Console.WriteLine($"Conflicts this run: {conflicts.Count}");

foreach (var ev in conflicts)
{
    Console.WriteLine($"  Key={ev.RecordKey}  " +
                      $"Resolution={ev.Resolution}  " +
                      $"Rule={ev.AppliedRuleKey}");
}

Retry & Checkpoint

Configure RetryPolicy to automatically re-attempt on transient errors and resume from a mid-run checkpoint without re-processing already-committed batches.

RetryPolicy

schema.RetryPolicy = new RetryPolicy
{
    MaxAttempts              = 4,
    BaseDelayMs              = 2000,
    BackoffMode              = "Exponential",  // "Fixed" | "Linear" | "Exponential"
    MaxResumeWindowHours     = 48,             // checkpoint invalidated after 48 h

    CheckpointEnabled        = true,           // save offset after each committed batch

    // Rule Engine key that classifies errors into categories
    ErrorCategoryRuleKey     = "sync.error.classify",

    NonRetryableCategories   = new List<string> { "Fatal", "Validation" },
};

Error categories

CategoryDefault actionDescription
TransientRetryNetwork timeout, transient DB lock
ValidationQuarantineSchema mismatch, constraint violation
ConflictRetryOptimistic-concurrency write conflict
FatalAbortAuthentication failure, data source not found

If the rule key ErrorCategoryRuleKey is not set or the rule engine is disabled, TryClassifyError applies keyword heuristics (e.g. "timeout" → Transient, "constraint" → Validation).

Checkpoint resume

// After a partial failure the checkpoint is stored in schema.ActiveCheckpoint.
// On the next call to SyncDataAsync, the manager calls IsCheckpointResumeSafe()
// which evaluates the rule "sync.checkpoint.resume-safe" or checks the age window.

// Force a full re-run by clearing the checkpoint:
schema.ActiveCheckpoint = null;
await syncManager.SyncDataAsync(schema, CancellationToken.None, progress);

Schema Governance & Promotion

PromoteSchemaAsync advances a schema through an approval lifecycle (e.g. Draft → Review → Approved). A rule engine gate can block promotion if the mapping quality or approval evidence is insufficient.

PromoteSchemaAsync

Task<SyncPreflightReport> PromoteSchemaAsync(
    DataSyncSchema    schema,
    string            targetState,    // e.g. "Review", "Approved", "Archived"
    string            approver   = null,
    string            changeNotes = null,
    CancellationToken token      = default
);

Promotion pipeline

#StepGate
1Null / empty checks on schema and targetStateHard fail
2Rule sync.schema.promotion-gate evaluated with schema, targetState, mappingApprovalState, requiredApprovalState contextConfigurable block
3Version artifact built (SHA hash of schema content, stamped with approver + notes)—
4Schema persisted via SaveSchemasAsync—

Example

var report = await syncManager.PromoteSchemaAsync(
    schema,
    targetState  : "Approved",
    approver     : "data-steward@example.com",
    changeNotes  : "Reviewed mapping completeness — 100%"
);

if (report.IsApproved)
    Console.WriteLine("Schema promoted to Approved.");
else
    foreach (var issue in report.Issues)
        Console.WriteLine($"  BLOCKED: {issue.Code} — {issue.Message}");

Sync Metrics

SyncMetrics is the telemetry model emitted (and stored via SyncProgressHelper) after every run.

SyncMetrics properties

PropertyTypeDescription
SchemaIDstringID of the sync schema that produced this record
SyncDateDateTimeWhen the sync run started
TotalRecordsintTotal records considered for sync
SuccessfulRecordsintRecords successfully written to destination
FailedRecordsintRecords that raised an error
SkippedRecordsintRecords skipped (filter, dedup, quarantine)
RecordsInsertedintNet new inserts
RecordsUpdatedintUpdates to existing rows
RecordsDeletedintDeletions (if delete-propagation enabled)
DurationTimeSpanTotal wall-clock time for the run
AverageRecordProcessingTimeTimeSpanComputed: Duration / TotalRecords
SuccessRatedoubleComputed: SuccessfulRecords / TotalRecords × 100

Rule Execution Policies

SyncRuleExecutionPolicies provides two pre-built RuleExecutionPolicy profiles used internally when invoking the rule engine at each gate.

ProfileMaxDepthMaxExecutionMsAllowDeprecatedUse case
DefaultSafe105000falseCritical gates: preflight, conflict, promotion
FastPath32000falseHigh-volume DQ checks, performance-sensitive paths
// The schema's performance profile mode selects the policy at runtime:
var policy = SyncRuleExecutionPolicies.Resolve(schema.PerformanceProfile?.RulePolicyMode);
// "FastPath" → FastPath profile; anything else → DefaultSafe

Built-in rule keys used by BeepSyncManager

Rule keyPhasePurpose
sync.plan.validatePreflightPolicy-driven schema validation
sync.dq.mapping-qualityPre-importMapping completeness quality gate
sync.audit.pre-runPre-importEmit audit telemetry before data movement
sync.perf.profilePre-importSelect RU / parallel-degree tuning values
sync.watermark.filterCDCOverride built-in watermark filter generation
sync.watermark.late-arrivalCDCClassify and route late-arriving records
sync.conflict.<strategy>ConflictCustom or built-in conflict resolution
sync.error.classifyRetryClassify error string into retry categories
sync.checkpoint.resume-safeCheckpointDecide whether an existing checkpoint is current enough to resume from
sync.schema.promotion-gateGovernanceBlock or allow schema promotion to target approval state

Helper Classes

All five helpers are instantiated by BeepSyncManager internally. You can also instantiate them directly for unit testing or standalone use.

ClassFileResponsibility
DataSourceHelperHelpers/DataSourceHelper.csOpen connections, fetch records, insert/update with error capture
FieldMappingHelperHelpers/FieldMappingHelper.csAutoMapFields by name, type-safe value conversion between source and destination schemas
SyncValidationHelperHelpers/SyncValidationHelper.csValidate schema completeness, data source accessibility, entity existence, watermark policy
SyncProgressHelperHelpers/SyncProgressHelper.csProgress events, structured log messages, run-history tracking
SchemaPersistenceHelperHelpers/SchemaPersistenceHelper.csAsync save/load JSON, per-schema backup, atomic replace

AutoMapFields

var fieldHelper = new FieldMappingHelper(editor);

// Returns List<FieldSyncData> for all columns with matching names
var mappings = fieldHelper.AutoMapFields(
    "SourceDB", "Customers",
    "DestDB",   "Customers");

// Override specific mappings after auto-map:
var nameMapping = mappings.First(m => m.SourceField == "ContactName");
nameMapping.DestinationField = "FullName";

ValidateWatermarkPolicy

var validationHelper = new SyncValidationHelper(editor);

var result = validationHelper.ValidateWatermarkPolicy(schema);
if (result.Flag == Errors.Failed)
    Console.WriteLine($"[ERROR] {result.Message}");

Examples

Eight runnable examples live in Editor/BeepSync/Examples/. Below is a representative selection.

Example 01 — Basic full sync

// Example01_BasicFullSync.cs
var syncManager = new BeepSyncManager(editor);
var schema = new DataSyncSchema
{
    Id                        = Guid.NewGuid().ToString(),
    SourceDataSourceName      = "SourceDB",
    DestinationDataSourceName = "DestDB",
    SourceEntityName          = "Customers",
    DestinationEntityName     = "Customers",
    SourceKeyField            = "CustomerId",
    DestinationKeyField       = "CustomerId",
    SyncType                  = "Full",
    SyncDirection             = "OneWay",
    BatchSize                 = 500,
};

var fieldHelper = new FieldMappingHelper(editor);
foreach (var m in fieldHelper.AutoMapFields("SourceDB","Customers","DestDB","Customers"))
    schema.MappedFields.Add(m);

syncManager.AddSyncSchema(schema);
await syncManager.SyncDataAsync(schema, CancellationToken.None,
    new Progress<PassedArgs>(p => Console.WriteLine(p.Messege)));

Console.WriteLine($"Status: {schema.SyncStatus}  LastSync: {schema.LastSyncDate:u}");

Example 03 — Incremental sync with watermark

// Example03_IncrementalSync.cs
var schema = new DataSyncSchema
{
    // ... source/dest/entity/key fields ...
    SyncType  = "Incremental",
    WatermarkPolicy = new WatermarkPolicy
    {
        WatermarkMode        = "Timestamp",
        WatermarkField       = "UpdatedAt",
        OverlapWindowSeconds = 300,
        DedupeStrategy       = "LastWrite",
        ReplayEnabled        = true,
    },
};

// First run — syncs records changed since epoch:
await syncManager.SyncDataAsync(schema, CancellationToken.None, null);

// Second run — only picks up records changed since the first run:
await syncManager.SyncDataAsync(schema, CancellationToken.None, null);

Example 04 — Bidirectional conflict resolution

// Example04_BidirectionalConflict.cs
schema.SyncDirection  = "Bidirectional";
schema.WatermarkPolicy = new WatermarkPolicy
    { WatermarkMode = "Timestamp", WatermarkField = "ModifiedAt", ReplayEnabled = true };

schema.ConflictPolicy = new ConflictPolicy
{
    ResolutionRuleKey   = "sync.conflict.latest-timestamp-wins",
    CaptureEvidence     = true,
    QuarantineDsName    = "QuarantineDB",
    QuarantineEntity    = "ConflictQuarantine",
    MaxConflictsPerRun  = 500,
    OnMaxExceededAction = "QuarantineRest",
};

await syncManager.SyncDataAsync(schema, CancellationToken.None, null);

foreach (var ev in syncManager.LastRunConflicts)
    Console.WriteLine($"Key={ev.RecordKey}  Resolution={ev.Resolution}");

Example 05 — Retry with checkpoint resume

// Example05_RetryAndCheckpoint.cs
schema.RetryPolicy = new RetryPolicy
{
    MaxAttempts           = 4,
    BaseDelayMs           = 2000,
    BackoffMode           = "Exponential",
    MaxResumeWindowHours  = 48,
    CheckpointEnabled     = true,
    ErrorCategoryRuleKey  = "sync.error.classify",
    NonRetryableCategories = new List<string> { "Fatal", "Validation" },
};

// Run 1 — saves a checkpoint if it fails mid-way
await syncManager.SyncDataAsync(schema, CancellationToken.None, progress);

// Run 2 — resumes from the checkpoint automatically if it is still within 48 h
await syncManager.SyncDataAsync(schema, CancellationToken.None, progress);

// Force full re-run:
schema.ActiveCheckpoint = null;
await syncManager.SyncDataAsync(schema, CancellationToken.None, progress);

Example 02 — Schema versioning & promotion

// Example02_SchemaVersioning.cs
var ctx = new SyncIntegrationContext
{
    RuleEngine     = myRuleEngine,
    RunInitiatedBy = "data-steward@example.com",
};
var syncManager = new BeepSyncManager(editor, ctx);

// ... add schema, configure mappings ...

var report = await syncManager.PromoteSchemaAsync(
    schema,
    targetState  : "Approved",
    approver     : "data-steward@example.com",
    changeNotes  : "All mappings reviewed and complete."
);

if (report.IsApproved)
    Console.WriteLine("Schema is now Approved and versioned.");
else
    foreach (var issue in report.Issues)
        Console.WriteLine($"[BLOCKED] {issue.Code}: {issue.Message}");

All examples summary

FileTopic
Example01_BasicFullSync.csOne-way full sync, automap, basic run
Example02_SchemaVersioning.csSchema versioning & PromoteSchemaAsync
Example03_IncrementalSync.csTimestamp watermark, repeated delta runs
Example04_BidirectionalConflict.csBidirectional sync, conflict policy, quarantine
Example05_RetryAndCheckpoint.csRetry policy, exponential back-off, checkpoint resume
Example06_DataQualityAndReconciliation.csDQ gates, mapping quality, reconciliation report
Example07_SloAndAlerting.csSLO thresholds, SyncMetrics, alerting integration
Example08_PerformanceAndParallel.csParallel bulk sync, performance profile tuning

Full API Reference

BeepSyncManager — Complete Public Surface

CategoryMethodReturn
ConstructorsBeepSyncManager(IDMEEditor)—
BeepSyncManager(IDMEEditor, SyncIntegrationContext)—
Core SyncSyncDataAsync(schema, token?, progress?, errorStore?, historyStore?)Task<IErrorsInfo>
SyncData(schema) / SyncData(schema, token, progress)void
Bulk SyncSyncAllDataAsync(token?, progress?)Task
SyncAllDataParallelAsync(token?, progress?)Task
SyncAllData() + 6 SyncData(schemaId, ...) overloadsvoid
Schema CRUDAddSyncSchema(schema)void
RemoveSyncSchema(id)void
UpdateSyncSchema(schema)void
AddFilter(schemaId, filter) / RemoveFilter(schemaId, fieldName)void
AddFieldMapping(schemaId, field)void
ValidateSchema(schema)IErrorsInfo
SaveSchemasAsync() / LoadSchemasAsync()Task
Preflight/GovernanceRunPreflightAsync(schema, token?)Task<SyncPreflightReport>
PromoteSchemaAsync(schema, targetState, approver?, notes?, token?)Task<SyncPreflightReport>

Core Properties

PropertyTypeAccess
SyncSchemasObservableBindingList<DataSyncSchema>get; set;
IntegrationContextSyncIntegrationContextget; set;
LastRunConflictsList<ConflictEvidence>get; private set;
LastRunCheckpointSyncCheckpointget; private set;
LastRunReconciliationReportSyncReconciliationReportget; private set;
Filepathstringget; set;
EditorIDMEEditorget; (returns _editor)

SyncMetrics — Complete Properties (23)

PropertyTypeNotes
SchemaIDstringSchema identifier
SyncDateDateTimeTimestamp of sync run
TotalRecordsintTotal records processed
SuccessfulRecordsintSuccessfully synced
FailedRecordsintFailed records
SkippedRecordsintSkipped records
RecordsInsertedintNew records inserted
RecordsUpdatedintExisting records updated
RecordsDeletedintSoft-deleted records
DurationTimeSpanTotal runtime
AverageRecordProcessingTimeTimeSpanComputed: Duration / TotalRecords
SuccessRatedoubleComputed: Successful / Total × 100%
IsSuccessfulboolComputed: Failed==0 && Total>0
ErrorMessagesList<string>Error messages
MetadataDictCustom metadata
MappingPlanVersionstringMapping version
CorrelationIdstringCorrelation identifier
RejectRatedoubleDQ rejection rate
ConflictRatedoubleConflict occurrence rate
FreshnessLagSecondsdoubleData freshness lag
RetryCountintTotal retries
RuleEvaluationCountintRule engine invocations
SloComplianceTierstringSLO compliance label
MappingDriftDetectedboolMapping drift indicator

ISyncValidationHelper — Complete Interface

MethodReturn
ValidateSchema(DataSyncSchema)IErrorsInfo
ValidateDataSource(string)IErrorsInfo
ValidateEntity(string, string)IErrorsInfo
ValidateSyncOperation(DataSyncSchema)IErrorsInfo
ValidateWatermarkPolicy(DataSyncSchema)IErrorsInfo
EvaluateDqGateRules(schema, record, ruleEngine?)List<DqGateResult>
FillMissingFieldsWithDefaults(schema, record, defaultsMgr)int
CheckMappingQualityGate(schema, out score, out band)IErrorsInfo

ISyncProgressHelper — Complete Interface

MethodReturn
ReportProgress(progress, message, current, total)void
BuildReconciliationReport(schema, runId, ... 16 params)SyncReconciliationReport
LogMessage(message, errorLevel?)void
LogSyncRun(schema)void
LogError(schema, message, ex?)void
LogCancellation(schema, progress)void
LogSuccess(schema, recordsProcessed, progress?)void
EmitSloMetrics(schema, metrics, runId, ... 6 params)void
EvaluateAlertRules(schema, metrics, ruleEngine)List<SyncAlertRecord>
BuildAlertPayload(schema, metrics, ruleKey, ruleOutputs)SyncAlertRecord

ISchemaPersistenceHelper — Complete Interface

MethodReturn
SaveSchemasAsync(IEnumerable<DataSyncSchema>)Task
LoadSchemasAsync()Task<ObservableBindingList<DataSyncSchema>>
SaveSchemaAsync(DataSyncSchema)Task
DeleteSchemaAsync(string schemaId)Task
SaveVersionedSchemaAsync(schema, SyncSchemaVersion)Task
LoadSchemaVersionsAsync(schemaId)Task<List<SyncSchemaVersion>>
DiffSchemaToPersistedAsync(schema)Task<string>
SaveCheckpointAsync(SyncCheckpoint)Task
LoadCheckpointAsync(schemaId)Task<SyncCheckpoint>
ClearCheckpointAsync(schemaId)Task
CreateBackupAsync()*Task<bool>
GetSchemasFilePath()*string
SchemasFileExists()*bool

*Additional members beyond ISchemaPersistenceHelper interface.

IDataSourceHelper & IFieldMappingHelper

public interface IDataSourceHelper
{
    IDataSource GetDataSource(string name);
    bool ValidateDataSourceConnection(string name);
    Task<object> GetEntityDataAsync(string ds, string entity, List<AppFilter>);
    Task<IErrorsInfo> InsertEntityAsync(string ds, string entity, object entity);
    Task<IErrorsInfo> UpdateEntityAsync(string ds, string entity, object entity);
    Task<bool> EntityExistsAsync(string ds, string entity, List<AppFilter>);
}

public interface IFieldMappingHelper
{
    List<FieldSyncData> AutoMapFields(string srcDS, string srcEntity, string destDS, string destEntity);
    IErrorsInfo ValidateFieldMappings(IEnumerable<FieldSyncData>);
    IEnumerable<FieldSyncData> LoadGovernedMapping(DataSyncSchema);
    bool CheckMappingDrift(DataSyncSchema, IEnumerable<FieldSyncData> baseline);
    IErrorsInfo PromoteMappingState(DataSyncSchema, string targetState);
}

SyncSchemaTranslator — Static API

public static class SyncSchemaTranslator
{
    // Converts BeepSync schema → DataImportManager configuration
    public static DataImportConfiguration ToImportConfiguration(
        DataSyncSchema schema,
        IImportErrorStore errorStore = null,
        IImportRunHistoryStore historyStore = null);

    // Converts BeepSync schema → reverse-direction DataImportManager configuration
    public static DataImportConfiguration ToReverseImportConfiguration(
        DataSyncSchema schema,
        IImportErrorStore errorStore = null,
        IImportRunHistoryStore historyStore = null);
}

SyncRuleExecutionPolicies

public static class SyncRuleExecutionPolicies
{
    public static RuleExecutionPolicy DefaultSafe;  // MaxDepth=10, MaxExecutionMs=5000
    public static RuleExecutionPolicy FastPath;      // MaxDepth=3, MaxExecutionMs=2000

    public static RuleExecutionPolicy Resolve(string mode);
    // Returns FastPath if mode == "FastPath" (case-insensitive), otherwise DefaultSafe
}

Model Types

CdcFilterContext

PropertyTypeDescription
SchemaIdstringSchema identifier
WatermarkFieldstringField used for watermark tracking
WindowStartobjectStart of CDC window
WindowEndobjectEnd of CDC window
WindowOpenedAtDateTimeWhen window opened (UtcNow)
ResolvedFiltersList<AppFilter>Resolved CDC filters
LateArrivalActionstring"include" (default)
TombstoneActionstring"soft-delete" (default)
WatermarkFieldDriftedboolWatermark field schema drift detected
NewWatermarkValueobjectNext window start for next run

SyncIntegrationContext

PropertyTypeDefault
RuleEngineIRuleEngine?null
DefaultsManagerIDefaultsManager?null
MappingPlanVersionint-1
GovernanceScopeIdstring?null
RunInitiatedBystringEnvironment.UserName
CorrelationIdstringGuid.NewGuid()

SyncPlanMetadata

PropertyTypeDefault
PlanIdstringGuid.NewGuid()
Name / OwnerTeam / Descriptionstring?null
CreatedBy / LastModifiedBy / ApprovedBystring?null
CreatedAt / LastModifiedAtDateTimedefault
ApprovedAtDateTime?null
LifecycleStatestring"Draft"
SchemaVersionint1
Environmentstring?null
RuleCatalogVersionstring?null
MappingVersionint-1

Source File Map (29 files)

FileContent
BeepSyncManager.Core.csConstructor (2), 7 properties, 3 helpers, Dispose pattern
BeepSyncManager.Sync.csSyncDataAsync main orchestration, SyncData overloads, 7 private pipeline methods (checkpoint, DQ, SLO, recon)
BeepSyncManager.Cdc.csBuildCdcFilterContext: watermark window + late-arrival + tombstone policy
BeepSyncManager.RetryCheckpoint.csTryClassifyError (rule engine + keyword fallback), IsCheckpointResumeSafe
BeepSyncManager.ConflictResolution.csTryEvaluateConflictGate (rule engine + DestinationWins fallback + evidence capture)
BeepSyncManager.BulkSync.csSyncAllDataAsync, SyncAllDataParallelAsync, 6 SyncData(schemaId) overloads
BeepSyncManager.SchemaManagement.csAdd/Remove/Update schema, Add/Remove filter, AddFieldMapping, ValidateSchema, Load/Save
BeepSyncManager.Preflight.csRunPreflightAsync (7 validation checks), BuildRulePolicy
BeepSyncManager.SchemaGovernance.csPromoteSchemaAsync (governed promotion + versioning + mapping co-promotion)
SyncRuleExecutionPolicies.csDefaultSafe + FastPath policies, Resolve(mode)
SyncMetrics.cs23 properties (3 computed), FromImportRunRecord, ToString
Interfaces/ISyncHelpers.cs5 interfaces: IDataSourceHelper (6), IFieldMappingHelper (5), ISyncValidationHelper (8), ISyncProgressHelper (10), ISchemaPersistenceHelper (10)
Helpers/DataSourceHelper.csGetDataSource, ValidateConnection, GetEntityDataAsync, InsertEntityAsync, UpdateEntityAsync, EntityExistsAsync
Helpers/FieldMappingHelper.csAutoMapFields, ValidateFieldMappings, LoadGovernedMapping, CheckMappingDrift, PromoteMappingState
Helpers/SchemaPersistenceHelper.cs10 interface methods + 3 extra: backup, file path check, 3 versioning methods, 3 checkpoint methods
Helpers/SyncProgressHelper.csReportProgress, LogMessage/LogSyncRun/LogError/LogCancellation/LogSuccess, BuildReconciliationReport, EmitSloMetrics, EvaluateAlertRules, BuildAlertPayload
Helpers/SyncSchemaTranslator.csToImportConfiguration + ToReverseImportConfiguration (BeepSync schema → DataImportManager config)
Helpers/SyncValidationHelper.cs5 validation methods + DQ gates, defaults fill, mapping quality gate
Models/CdcFilterContext.cs10 window + late-arrival + tombstone properties
Models/SyncIntegrationContext.cs6 integration dependency properties
Models/SyncPlanMetadata.cs16 lifecycle + governance + versioning properties
Examples (8)
Example01_BasicFullSync.csOne-way full sync, automap, basic run
Example02_SchemaVersioning.csSchema versioning & PromoteSchemaAsync
Example03_IncrementalSync.csTimestamp watermark, repeated delta runs
Example04_BidirectionalConflict.csBidirectional sync, conflict policy, quarantine
Example05_RetryAndCheckpoint.csRetry policy, exponential back-off, checkpoint resume
Example06_DataQualityAndReconciliation.csDQ gates, mapping quality, reconciliation report
Example07_SloAndAlerting.csSLO thresholds, SyncMetrics, alerting integration
Example08_PerformanceAndParallel.csParallel bulk sync, performance profile tuning