locked
Manually commit single local changes so they are not synched RRS feed

  • Question

  • Hi,

     

    it's me again with another SyncServices question. I want to "commit" single local changes made to the client database (sql ce) manually, so they are not synched to the server the next time.

     

    What I found in docs is the AcceptChanges() method on the sqlce provider, but I am not sure on how to implement it correctly for my needs. My scenario is as follows, during a sync I get an insert from the server. In my ApplyingChanges event handler I filter for newly inserted rows with a specific flag being set. In this case I want to manually delete a row in the local db. But this delete should not be reflected back to the server, as this row does only exist on the client. It does not cause any errors, when the delete is propagated to the server, as there is no row with this id, but it is useless and just eating time and transfer. So what I want to achieve is to run a single sql delete command against the local DB, which is not "recorded" by the local changetracking. Is there any way to achieve such a behaviour without loosing all other changes?

     

    The other possibility that came to my mind is to manually remove the according entries in the "metadata" tables in the client db like __sysOCSDeleted. But manually messing with metadata does not seem like a good idea to me.

     

    Any recommendations for me?

     

    Regards,

    Andreas

    • Moved by Max Wang_1983 Friday, April 22, 2011 6:58 PM forum consolidation (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Thursday, June 26, 2008 9:33 AM

Answers

  • Unfortunately the scenario you guys described is not supported with currently release of the client provider. if you are implementing your own client provider, you can expose some property or create some global flag so that some change is not tracked if the flag is on.

     

    thanks

    Yunwen

     

    Thursday, June 26, 2008 8:08 PM
    Moderator

All replies

  • I do have similar requirement, I tried different ways to implement this, to reset _sysChangeTxBsn column.

     

    Reading data to dataset and change RowVersion, Chaning RowState to unchanged....etc.,

    Let me know if you find any solution.

     

    Thursday, June 26, 2008 3:41 PM
  • Unfortunately the scenario you guys described is not supported with currently release of the client provider. if you are implementing your own client provider, you can expose some property or create some global flag so that some change is not tracked if the flag is on.

     

    thanks

    Yunwen

     

    Thursday, June 26, 2008 8:08 PM
    Moderator
  • Hi Yunwen,

     

    thank you for your reply.

    So the only options I have for now are either implementing a custom provider or use AcceptChanges(), which overrides ALL local changes did I get that right? Perhaps I can somehow manage that there are no further local changes that would be accidentally overriden. Will have to step into this.

     

    Thanks,

    Andreas

     

    Monday, June 30, 2008 11:28 AM
  • to use AcceptChanges() would be a easier approach. the essential idea is to hook your you logic to the ChangesSelected event at the client provider and work on the dataset ( the changes ) exposed in the event, to remove the changes you don't want to send to the server.

     

    thanks

    Yunwen

    Sunday, July 13, 2008 5:08 PM
    Moderator