Search code examples
c#web-servicesmicrosoft-sync-framework

how to customize sync according to selected data only sync framework / trick to do it


I am developing an sync database application for one of my client i am done with synchronization but now i stuck at a part that i don`t want to sync complete table i just wana sync dynamically selected record through sync framework

using sqlce at client end

Any good link which make some help will also be preferable

i am sync ing some thing like below at server

public SyncContext GetChanges(SyncGroupMetadata groupMetadata, SyncSession syncSession)
    {
        return serverSyncProvider.GetChanges(groupMetadata, syncSession);
    }



    public SyncContext ApplyChanges(SyncGroupMetadata groupMetadata, DataSet dataSet, SyncSession syncSession)
    {
        return serverSyncProvider.ApplyChanges(groupMetadata, dataSet, syncSession);
    }

Solution

  • you can add a filter to restrict the rows being synched. Sync Framework however does not support dynamic filtering. Sync framework does synchronization based on incremental syncs of what has changed since the last sync.

    for example, assuming you have a customer table and you let a user pick which customer to sync.

    you will most likely store the customers that was picked for synching in another table, let's say SelectedCustomer which would store the user id. and the customer id.

    when a user adds or removes a customer from his selection, you would update the SelectedCustomer. However, when you sync Customer table, you won't get anything not unless the specific customer record has been changed since the last sync. Even if a customer was added to a specific user, the actual customer record is not updated, no update, no change detected.