none
Microsoft's DB Sync Framework

    Question

  • I know that the sync framework tracks changes and part of the information stored is the time of the change. My question this, is the time of the change accessible through any of the framework's objects. I have  a requirement to resolve data conflicts by giving the datarow with the latest change precedence, but the ApplyChangeFailed event does not seem to supply the time of changes on both the server and client.
    Monday, July 29, 2013 10:22 PM

All replies

  • the change tracking uses "timestamps" which has nothing to do with the date and time a change was done.

    if you want a custom conflict resolution based on the date and time of updated, just add an "update_date" column to the table you're synching and do the comparison on that column. 

    Tuesday, July 30, 2013 1:09 AM
    Moderator
  • Excuse me, I thought not having to change the DB's schema was one of the benefits of using the Sync Framework. It seems to me that Microsoft has made a mistake in not recording the time of change and making it available for conflict resolution. Also why not have some support for conflicts at field level instead at just row level?
    Wednesday, July 31, 2013 10:34 PM
  • why should it? 

    it's built-in conflict resolution has nothing to do with who update which first.

    change tracking is at row level, it doesn't record what has changed, just that the row was changed.

    Thursday, August 01, 2013 3:22 AM
    Moderator
  • Because there will be certain applications where conflict resolution will be time dependent. Providing the time of change would help and I would have thought quite easy.
    • Edited by LoneRanger10 Thursday, September 26, 2013 11:49 PM
    Thursday, September 26, 2013 11:48 PM
  • but there's no stopping you adding a datetime column that you can compare for your conflict resolution.
    Friday, September 27, 2013 1:33 AM
    Moderator
  • Likewise there was nothing stopping Microsoft adding it to the Sync Framework. It would have saved some developers some work, which is one of the Framework's objectives.

    Your sweeping assumption does not detract anything from my previous statement.

    Saturday, September 28, 2013 9:13 PM
  • it's an SDK and was precisely designed for you to be able to handle the custom resolution. 

    there's a whole dozen other scenarios to resolve  conflicts: based on time, based on who updated it, based on where it's updated, base on custom logic, etc...

    why default it to something when you can let the dev decide on how they want it?

    you just said its easy, then why the fuzz if you can easily plug it in?


    Tuesday, October 01, 2013 2:08 AM
    Moderator
  • I'm not saying the default should change at all. If you read my very first comment again you will see that I am suggesting that the time of change should be provided by the ApplyChangeFailed event. I don't understand your second comment where you say,

              the change tracking uses "timestamps" which has nothing to do with the date and time a change was done.

    What exactly do the timestamps record if they do not record the time of the change?
    • Edited by LoneRanger10 Wednesday, October 02, 2013 5:25 PM
    Wednesday, October 02, 2013 5:23 PM
  • I used sync framework, silverlight and isolated storage for an offline application. It has 2 issue:

    1- Sometimes it lose connection to local data.It seems local data is not readable. when I clear cache ,it works but I can't clear user's data. what is wrong? 

    2- After a while,when user use application,it will be slow. like 30 minutes to sync. file size is 20 Meg. again,when I clear cache ,it sync data in 1 minute.

    Friday, October 04, 2013 1:45 AM
  • you should read what timestamp data types are in SQL Server. 
    Friday, October 04, 2013 2:55 AM
    Moderator
  • Hi JuneT,

    can you explain more.What should be timestamp data types in sql server. 

    Thursday, October 10, 2013 4:48 PM
  • you should read what timestamp data types are in SQL Server. 

    Not a very helpful answer but adequate. I C Microsoft have changed the name of this type to RowVersion, which is a much better descriptive name. Looks like I was not the only one who was confused by it.

    I've have another question about the Sync framework. If an error occurs during a sync, how can the framework be rolled-back to allow the sync to be restarted? Apparently, the sync framework seems to assume the sync will succeed and so only allows one chance at a sync. Personally I think it should be similar to a transaction where a sync is only considered successful if it is committed via some sort of API call and rolled back by default.

    Sunday, October 13, 2013 3:44 PM
  • what type of error? and what do you mean one chance at sync? you can always fire a sync anytime.

    if an error and the sync cannot continue, it will rollback on its own.

    if there are errors applying individual rows, those are fired in the ApplyChangeFailed event and you can deal with them row by row.

    you need to clarify what constitutes a successful sync to you. a conflict occuring for a specific row shouldn't be failing the entire sync. it only means that of X number of rows, that row cannot be applied.

    Saturday, November 16, 2013 6:42 PM
    Moderator