locked
Conflict Handling with web services RRS feed

  • Question

  • Hi,

    I am using web service for synchronisation as shown in Demo III Offline Application - Web Service example.

    I want to add code for conflict handling at server side.

    I have checked the Demo IV Offline Application - Conflict Handling.

    It uses ShowServerFailures() method to handle conflicts at server side.

    If I want to use this method in my web service, how do I do that?

     

    I have added this code to web service

     

    _DbServerSyncProvider.ApplyChangeFailed += new EventHandler<ApplyChangeFailedEventArgs>(ShowServerFailures);

     

    Here _DbServerSyncProvider is object of DbServerSyncProvider.

     

    I have also added the following method in web service.

     

    public void ShowServerFailures(object syncAgent, ApplyChangeFailedEventArgs args)

        {

            if (args.Conflict.ConflictType == ConflictType.ClientInsertServerInsert)

            {

                // ClientInsertServerInsert

            }

            if (args.Conflict.ConflictType == ConflictType.ClientUpdateServerUpdate)

            {

                // ClientUpdateServerUpdate

            }

            if (args.Conflict.ConflictType == ConflictType.ClientDeleteServerUpdate)

            {

                // ClientDeleteServerUpdate

            }

            if (args.Conflict.ConflictType == ConflictType.ClientUpdateServerDelete)

            {

                // ClientUpdateServerDelete

            }

        }

     

    But it is giving runtime error as

    “Microsoft.Synchronization.Data.ApplyChangeFailedEventArgs cannot be serialized because it does not have a parameterless constructor”

     

    Is it a right way of handling server side conflict with web service?

     

     

    Regards

    Swati

    • Moved by Max Wang_1983 Friday, April 22, 2011 10:31 PM forum consolidation (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Friday, July 6, 2007 1:56 PM

Answers

  • Hi Swati,

     

    I just tried your scenario and it worked fine. The serialization error would be expected if you wanted to pass on the event to the client which then require serialization but if you try to handle the conflict on the server side (on your IIS machine) then it should work fine.

     

    Thanks

    Monday, July 9, 2007 4:34 PM

All replies

  • Hi Swati,

     

    I just tried your scenario and it worked fine. The serialization error would be expected if you wanted to pass on the event to the client which then require serialization but if you try to handle the conflict on the server side (on your IIS machine) then it should work fine.

     

    Thanks

    Monday, July 9, 2007 4:34 PM
  • Thank you Rafik

     

     

    Swati

    Tuesday, July 10, 2007 10:35 AM