Consider the following scenario:
For example, table A contains a primary key that is referenced by table B as a foreign key. When a delete operation for a row in table A arrives in a batch and a delete operation for table B arrives in another batch, the delete operation in table A fails. The operation may fail because of a foreign key violation. The delete operation in table A is put in a retry queue. However, the ChangesApplied event is incorrectly called before all the failed changes that are in the retry queue are applied. Therefore, the business logic is broken in the ChangesApplied event.
- You create an application that uses Microsoft Sync Framework 2.1 to perform database synchronization on a computer.
- You configure the application to use batching for the delivery of changes.
- The application uses a handler to perform some actions if the ChangesApplied event is fired and if the DbSyncContext.IsLastBatch property is set to True.
- A change fails in one of the tables that are synchronized because of a constraint violation.
- The failed change operation is put in a retry queue.
For example, table A contains a primary key that is referenced by table B as a foreign key. When a delete operation for a row in table A arrives in a batch and a delete operation for table B arrives in another batch, the delete operation in table A fails. The operation may fail because of a foreign key violation. The delete operation in table A is put in a retry queue. However, the ChangesApplied event is incorrectly called before all the failed changes that are in the retry queue are applied. Therefore, the business logic is broken in the ChangesApplied event.