ApplyChanges not able to apply update and delete changes from dataset RRS feed

  • Question

  • Hello,

    I'm using Custom SyncProviders and SyncAgent to One-way Sync up my local and remote database.

    I have override the ApplyChanges method in my custom Provider.

    Now the issue I'm facing is - it can sync the newly added rows from local to remote DB but its unable to sync the updated and deleted rows. And since there's no exception or error in the process, I could not locate the cause of the problem.

    Hopefully someone could help me.



    Monday, November 25, 2013 8:34 PM

All replies

  • you're using a custom provider, so it's non-standard. without the code, we have no way of knowing how you're selecting changes.

    how do you mark updated and deleted rows in your custom provider?

    Thursday, November 28, 2013 1:22 AM
  • I am creating AnchorCommand using "change_tracking_current_version" to select inserted, deleted and updated rows.

    I can see while debugging that 'm selecting proper changes and also in ApplyChanges() method I can see correct rows in the dataset. It's just I can't see those rows being applied on the destination database. I can only see newly inserted rows but not the updated and the deleted ones.

    Monday, December 2, 2013 4:55 PM
  • can you enable Sync Fx tracing and post the log?

    likewise, when you say you see the rows in the ApplyChanges, are the rows properly tagged as Inserted/Updated/Deleted?

    • Marked as answer by ANKIT MAHAJAN Friday, December 6, 2013 11:57 PM
    • Unmarked as answer by ANKIT MAHAJAN Saturday, December 7, 2013 12:05 AM
    Tuesday, December 3, 2013 2:10 AM
  • Hey Thanks. I got it working by debugging the Sync Fx Tracing.

    I have another question not related to this context-

    I have two databases synced with each other. Now suppose there's an alteration in the server schema let say new column has been added in one of the table. So now is there a provision or some hook in Sync Framework where I could handle this case. Like framework detect those changes for me and I apply it on the client side before syncing next time?

    Friday, December 6, 2013 11:57 PM
  • Sync framework doesn't do schema syncs. It uses the schema you used in the provisioning. In your case, you can alter your commands to include the changes
    Saturday, December 7, 2013 1:58 AM
  • Thanks for the answer. 
    Wednesday, December 11, 2013 12:38 AM
  • Hi JuneT,

    Thanks for your answers. I have 1 more question hopefully you can guide me in the right direction.

    I have a requirement in my Sync operation wherein I want to filter out the changes caused by noisy columns.

    So consider a table with 5 columns (a, b, c, d, e) and (c, d) are the noisy columns. This means (c, d) are the columns whose value changes very very frequently thus creating lots of record in the changeTable. So we define these columns as noisy columns but we are only interested in the changes caused by (a, b, e). Though I want (c, d) to be synced but changes caused by (c, d) should not trigger the Syncing. This is to reduce the network traffic.

    Let say there are 5 records in the change table each of it is because of the change in value of 1 of the column and now whenever I do Sync I want only 3 records to be synced with client not the remaining 2 that were created by Noisy columns. 

    I know there's no out of the box implementation in Sync that I can use. But hopefully you can provide me with some potential solution.

    I tried doing some tricks like - fetching all records from changetable then join them with my table based on pimary key and  then mask the non-noisy columns to null based on the value of sys_change_column and lastly filtering out the null rows to get the required result set. But this approach is drastically increasing the processing time as the no. of non-noisy columns increases thus decreasing performance.

    Are there any workarounds?

    Friday, December 13, 2013 4:34 PM
  • you are using a custom sync provider and am not sure how you're tracking the changes. if its via triggers, then you can check if the columns being updated are the noisy columns and simply ignore them and not write something on the tracking tables.

    the OOTB sync providers can't do this either. Change tracking is at the row level, not at the column level. It only tracks that a row has changed, not which specific column was changed.

    since you're using a custom sync, you can very much take care of this on when you record change tracking.

    Monday, December 16, 2013 1:48 AM