locked
Conflict Exception Not Firing in Sync101 With Contstraint Conflicts Example from Codeplex RRS feed

  • Question

  • On the codeplex sample site ( http://code.msdn.microsoft.com/Release/ProjectReleases.aspx?ProjectName=sync&ReleaseId=3417 ), I'm expecting that when a conflict is created (as below, no changes to example) that the _itemconflcting callback would be called.  I put a break point there and it never gets hit. I swear I ran this a few days ago and it got hit.  I've gone back to the original zip, re unzipped it, rerun it and still it does not get hit.  I've tried referencing the 2.1 code also and get the same result.

    What am I missing?

    //Create an update-update conflict to merge.
          storeA.UpdateItem(1, new ItemData(DATA, "Did Merging"));
          storeB.UpdateItem(1, new ItemData(DATA, " Work?"));
    
          //Synchronize provider A and provider B.
          DoBidirectionalSync(providerA, storeA, providerB, storeB);
    
          //Create a create-create constraint conflict to merge.
          storeA.CreateItem(new ItemData(DATA, "Did Merging"), 7);
          storeB.CreateItem(new ItemData(DATA, " Work again?"), 7);
    
          //Sync provider A and provider B.
          DoBidirectionalSync(providerA, storeA, providerB, storeB);
    
     static void DestinationCallbacks_ItemConflicting(object sender, ItemConflictingEventArgs e)
        {
          Console.Write("Event Item conflicting: source data - {0}, ", e.SourceChangeData != null ? e.SourceChangeData.ToString() : null);
          Console.WriteLine("destination data - {0}", e.DestinationChangeData != null ? e.DestinationChangeData.ToString() : null);
          e.SetResolutionAction(ConflictResolutionAction.Merge);
        }
    

    Peter Kellner http://peterkellner.net Microsoft MVP • ASPInsider
    Wednesday, November 10, 2010 1:29 AM

Answers

  • Never mind. Figured it out.  The comments in the code explain it, that is I have to fire the conflicting event myself if I want it here.
    Peter Kellner http://peterkellner.net Microsoft MVP • ASPInsider
    • Marked as answer by Peter Kellner Wednesday, November 10, 2010 5:33 AM
    Wednesday, November 10, 2010 5:33 AM