locked
Determine First Sync RRS feed

  • Question

  •  

    Hi

    Is there a way to determine if it is the first time sync ?

    As it seems it has been removed .Right?

     

    Thanks in advance

     

    • Moved by Max Wang_1983 Friday, April 22, 2011 6:36 PM forum consolidation (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Monday, August 11, 2008 5:36 AM

Answers

  • Hello,

     

    After discussing this issue with a number of internal Sync Guru, I have filed a DCR to let the developement team know that there is a customer request which the client provider should support "determing first sync" in API.

     

    Before this DCR goes through the developement cycle, there are some other ideas which can help to determine the first sync. 

     

    However there are possibilities that these system table names might be changed in the future release.

     

    1. If a database is never sync-ed before, then either the sync system table __sysSyncArticles is unavailable or it is empty.

    2. if a "user table" is never sync-ed before, then either the sync system table __sysSyncArticles is unavailable or there is no user table entry in the __sysSyncArticles table.

     

    Wednesday, August 13, 2008 9:29 PM
    Answerer

All replies

  • There should be a sync session parameter called "@sync_initialized" you can reference.  "@sync_initialized = 0" means initial sync.

     

    Thanks.

    Monday, August 11, 2008 7:19 AM
    Answerer
  • So where to pull this from on client?

     

    Monday, August 11, 2008 7:30 AM
  • This one is for the server provider to tell whether this is a initial sync or incremental sync.

    On the client, I am not sure if there is a provided way of doing this. 

    But if you really like, can you try this

    After initial sync is succeeded, write a value to the registry so that when later sync comes in, it can tell whether this is an initial sync or incremental sync.

     

    Thanks.

    Monday, August 11, 2008 7:41 AM
    Answerer
  • That's the whole point - how DO I check on client if this was the initial sync?

    Checking if tables exist before sync is kind of awkward.

     

    Monday, August 11, 2008 7:45 AM
  • Assume - before the device does the initial sync, there is no registry value.  After the initial sync, the registry value is there.  So the device can tell whether the registry value is there or not.

     

    Thanks.
    Monday, August 11, 2008 8:00 AM
    Answerer
  • HOW do I know WHEN to write the registry value? How do I know if this was the initial sync?

    I don't need the registry value if I can find out when initial sync has happened.

    Monday, August 11, 2008 8:06 AM
  • 1. Before Sync, read the registry value,

        if value is unavailable, this is the initial sync

        if value can be read, this is incremental sync

    2. Do sync

    3. After Sync is done, write value to the registry

     

    Thanks.

     

    Monday, August 11, 2008 8:42 AM
    Answerer
  • Hi

    The way I.m doing it is by setting the @sync_initialized parameter value to 0 if it's the first time and otherwise to 1, from the client syncagent:

     

    this.Configuration.SyncParameters.Add(new SyncParameter("@sync_initialized", 1));

     

    I'm reading the @sync_initialized value at the server side and I'm getting the same value as the one I specify at the client side.

     

    Am I doing the right  thing?

     

    Thanks

    Monday, August 11, 2008 11:56 PM
  • Hello,

     

    I think Sync Service should set value for "@sync_initialized" internally.

    What you can try is to add this code to do an initial sync and see if @sync_initialized is still 1 on the server side.

     

    Thanks.

     

    Tuesday, August 12, 2008 8:42 AM
    Answerer
  • Hello,

     

    After discussing this issue with a number of internal Sync Guru, I have filed a DCR to let the developement team know that there is a customer request which the client provider should support "determing first sync" in API.

     

    Before this DCR goes through the developement cycle, there are some other ideas which can help to determine the first sync. 

     

    However there are possibilities that these system table names might be changed in the future release.

     

    1. If a database is never sync-ed before, then either the sync system table __sysSyncArticles is unavailable or it is empty.

    2. if a "user table" is never sync-ed before, then either the sync system table __sysSyncArticles is unavailable or there is no user table entry in the __sysSyncArticles table.

     

    Wednesday, August 13, 2008 9:29 PM
    Answerer