Modifications on Context object in ApplyChangeFailed event in Sync Framework v2.1 RRS feed

  • Question

  • Hello,

    I’m using Sync Framework v2.1 and SqlSyncProvider’s to sync SQL 2008 R2 and SQL Express 2008.


    What operations are allowed on e.Context object in ApplyChangeFailed event ? I know I can modify values in conflicted row and try ApplyAction.RetryWithForceWrite. But I’m investigating a little bit more complex case:



    Server, Client1 and Client2 contain a table with hierarchical data: Row1 and Row2 (where Row2 is a child row for Row1).

    Client1 deletes Row1 and commits his changes to Server -> both rows will be deleted from Server. It’s OK as this step.

    Client2 updates Row2 and tries to commit his changes.


    On ApplyChangeFailed (on Server) I’m getting DbConflictType.LocalDeleteRemoteUpdate which is fine as Server does not contain Row2.

    I set resolution action to ApplyAction.RetryWithForceWrite.


    Next I’m getting DbConflictType.ErrorsOccurred conflict reporting that Insert for Row2 fails because of missing parent row (Row1 is missing on Server). It’s OK at this step.


    Is there any way to modify Context object in ApplyChangeFailed  so that missing parent row Row1 from Client2 was added into the Context object and applied on Server ? Note, that Client2 has not modified Row1.  Of course Client2 should not get this change back (I mean added Row1) downloading changes from Server. Is such modification on Context in ApplyChangeFailed event supported by Sync Framework at all ?




    • Edited by kambarda Wednesday, December 28, 2011 12:26 AM
    Wednesday, December 28, 2011 12:25 AM

All replies

  • Hi,

    This scenario of adding rows to the ApplyChangeFailed context is not supported, not sure of any good workaround to your problem.  You could add the row outside of sync, but Client2 will get that change - but Client2 already has the row, so wouldn't it be fine?


    Wednesday, January 4, 2012 6:42 PM