Sync Framework: how to specify the synchronization order of multiple tables?

Does anyone know a way to synchronize multiple tables in a specific order. new created data appears in the details in both the parent and child tables, and parental insertion is required before the child completes.

+4
source share
2 answers

The processing order of each table depends on the order in which its SyncTable was added to the table collection for the synchronization agent.

The following table adds the customer table in front of the order table.

 SyncGroup customerOrderSyncGroup = new SyncGroup("CustomerOrder"); SyncTable customerSyncTable = new SyncTable("Customer"); customerSyncTable.CreationOption = TableCreationOption.DropExistingOrCreateNewTable; customerSyncTable.SyncDirection = SyncDirection.DownloadOnly; customerSyncTable.SyncGroup = customerOrderSyncGroup; this.Configuration.SyncTables.Add(customerSyncTable); SyncTable orderSyncTable = new SyncTable("Order"); orderSyncTable.CreationOption = TableCreationOption.DropExistingOrCreateNewTable; orderSyncTable.SyncDirection = SyncDirection.DownloadOnly; orderSyncTable.SyncGroup = customerOrderSyncGroup; this.Configuration.SyncTables.Add(orderSyncTable); 

More info here

+3
source

If you have records of basic details such as order and orderdetail, then try JUST tables associated with their own synchronization group (create other synchronization groups for other non-ideal tables), then synchronize this group inside the transaction. This ensures that both master and detailed records are synchronized or not executed.

Scream if you need more on how to do this.

+1
source

Source: https://habr.com/ru/post/1299965/


All Articles