locked
SQL Express Client sync provider Snapshot RRS feed

  • Question

  • Hi,

    We are trying to make 2 SQL Express databases synchronize. And use snapshot at initial synchronization..
    After that use bidirectional sync.

    When i try to sync with snapshot, the ChangesDownloaded value is 85, but no changes are applied.
    I'm using the Adapterbuilder, and had a look at it. It doesn't create a InsertCommand if the direction of the builder is on Snapshot.
    So I changed it to bidirectional(at Adapterbuilder) so it generates an InsertCommand..
    But still the synchronisation doesn't work.

    Someone that experianced the same problem?
    • Moved by Hengzhe Li Friday, April 22, 2011 3:26 AM (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Wednesday, April 22, 2009 9:09 AM

Answers

  • i found this should be changed in the SqlClientSyncProvider class

    public override SyncContext ApplyChanges(SyncGroupMetadata groupMetadata, DataSet dataSet, SyncSession syncSession)

    {

      //Map SyncDirection from client POV to our internal server POV

      foreach (SyncTableMetadata tableMetadata in groupMetadata.TablesMetadata)

      {

        if (tableMetadata.SyncDirection == SyncDirection.DownloadOnly || tableMetadata.SyncDirection ==   SyncDirection.Snapshot)

        {

          //This SyncDirection DownloadOnly/Snapshot is from a Client point of view. But our client is inturn a Server provider.   Hence switch this to UploadOnly

          tableMetadata.SyncDirection = SyncDirection.UploadOnly;

        }

        else if (tableMetadata.SyncDirection == SyncDirection.UploadOnly)

        {

          //This SyncDirection UploadOnly is from Client POV. But our client is inturn a Server provider. Hence switch this to DownloadOnly

          tableMetadata.SyncDirection = SyncDirection.DownloadOnly;

        }

      }

      SyncContext syncContext = _dbSyncProvider.ApplyChanges(groupMetadata, dataSet, syncSession);

      foreach (SyncTableMetadata table in groupMetadata.TablesMetadata)

      {

        SetTableReceivedAnchor(table.TableName, groupMetadata.NewAnchor);

      }

      return syncContext;

    }


    now snapshot is working...

    Wednesday, April 22, 2009 11:01 AM

All replies

  • I'd like to add that I'm using the SqlExpressClientSyncProvider from the examples...
    I've been looking in the ApplyChangesMethode. And the DbSynProvider has a table adapter with appropriate InsertCommand...

    So I guess the Sync Framework doesn't support Snapshot yet?
    Or do i need to change something to my SqlExpressClientSyncProvider class perhaps?
    Wednesday, April 22, 2009 10:26 AM
  • i found this should be changed in the SqlClientSyncProvider class

    public override SyncContext ApplyChanges(SyncGroupMetadata groupMetadata, DataSet dataSet, SyncSession syncSession)

    {

      //Map SyncDirection from client POV to our internal server POV

      foreach (SyncTableMetadata tableMetadata in groupMetadata.TablesMetadata)

      {

        if (tableMetadata.SyncDirection == SyncDirection.DownloadOnly || tableMetadata.SyncDirection ==   SyncDirection.Snapshot)

        {

          //This SyncDirection DownloadOnly/Snapshot is from a Client point of view. But our client is inturn a Server provider.   Hence switch this to UploadOnly

          tableMetadata.SyncDirection = SyncDirection.UploadOnly;

        }

        else if (tableMetadata.SyncDirection == SyncDirection.UploadOnly)

        {

          //This SyncDirection UploadOnly is from Client POV. But our client is inturn a Server provider. Hence switch this to DownloadOnly

          tableMetadata.SyncDirection = SyncDirection.DownloadOnly;

        }

      }

      SyncContext syncContext = _dbSyncProvider.ApplyChanges(groupMetadata, dataSet, syncSession);

      foreach (SyncTableMetadata table in groupMetadata.TablesMetadata)

      {

        SetTableReceivedAnchor(table.TableName, groupMetadata.NewAnchor);

      }

      return syncContext;

    }


    now snapshot is working...

    Wednesday, April 22, 2009 11:01 AM