How to use batching with custom change tracking in Sync Framework 2.1?

1.7k Views Asked by At

With Sync Framework 2.1, batching seems to have got in-built support, so in some of the providers we can just mention the batch size and the spool file location (and some other attributes) and the batching will be taken care of. Developers won't have to write their own batching logic.

However, this works only with a few providers like SqlSyncProvider or DbSyncProvider which seem to cater to SQL server change tracking. The earlier providers like ClientSyncProvider and DBServerSyncProvider which allows for custom change tracking don't seem to have much enhancements. Any idea how we can use the new batching feature and still retain our custom change tracking logic?

We don't have an option to shift to in-built change-tracking, since our custom logic handles non-symmetric databases (where server db is multitenanted and each client db is single tenant).

2

There are 2 best solutions below

2
On BEST ANSWER

We finally decided to implement our own custom batching solution - running the synchronize method in a loop, restricting the gap between last_sync_anchor and new_sync_anchor to 500 or so.

Though far from ideal (compared to MS implementation of using byte-size as a limiting factor) it works for us and allows us to stick to our custom implementation of change tracking and synchronization.

1
On

Batching is in-built supported only by SqlSyncProvider. You can control batching to some extent in DbSyncProvider by setting the MemoryDataCacheSize proeprty. However bad news is if you are using earlier version you dont have much options...