Answered by:
Remote Database Syncronization

Question
-
Hi,
I am currently working on Database syncronization between a local SQLCe database and a SQL Server database. In addition I am using scopes and filters in order to filter the syncronized data.
Following the example from http://msdn.microsoft.com/en-us/library/ff928701(v=SQL.110).aspx I finally write a simple application which sincronizes between a local SQLCe database and a local SQL Server database with Sync Framework 2.1.
Dim clientSqlCeConn As New Data.SqlServerCe.SqlCeConnection clientSqlCeConn.ConnectionString = "Data Source=" + localSQLCEPath clientSqlCeConn.Open() Dim serverConn As New SqlConnection serverConn.ConnectionString = My.Settings.ServercdCatServidorConnectionString serverConn.Open() Dim syncOrchestrator As New Microsoft.Synchronization.SyncOrchestrator() syncOrchestrator.Direction = Microsoft.Synchronization.SyncDirectionOrder.Download syncOrchestrator.LocalProvider = New SqlServerCe.SqlCeSyncProvider("FilterByIdClient" + FILTER_VALUETextBox.Text, clientSqlCeConn, Nothing) syncOrchestrator.RemoteProvider = New SqlSyncProvider("FilterByIdClient" + FILTER_VALUETextBox.Text, serverConn, Nothing, Nothing) syncStats = syncOrchestrator.Synchronize()
The code above works fine assuming that templates and filters has been created (which are). Note that both connections are defined as local databases.Now I would like to do the same syncronitzation but when the SQL Server database is only accesed by a WCF application service. I mean the SQL Server is not reacheable from the client, just for the WCF application service.
Note that in the syncronitzation process the SyncOrchestrator object needs the LocalProvider (the SQLCe database) and the RemoteProvider (SQL Server database which is actually defined as local). I wonder if it
I found this example http://msdn.microsoft.com/en-us/library/cc807255(SQL.100).aspx based on framework 1.0. Is there an easy way to do this on framework 2.1?
Thank you
Tuesday, October 19, 2010 6:07 PM
Answers
-
the code you cited above is using a different provider. The Local Database Cache Designer/Wizard uses the offline providers which out-of-the-box only supports SQL CE on the client (there is a sample SQL Express provider sample however). It's not really a v2.0. specific functionality but since v1.
The changes in v2.1 is more on the collaboration/peer-to-peer providers. You can still use the Local Database Cache designer, but there is nothing new in v2.1 for the providers that it uses other than improved support for the latest SQL CE Service pack that exposes the SQL CE change tracking.
- Proposed as answer by Sid Singh [MSFT]Microsoft employee Friday, October 22, 2010 8:15 PM
- Marked as answer by Dong CaoMicrosoft employee Wednesday, October 27, 2010 4:49 PM
Wednesday, October 20, 2010 5:25 PM
All replies
-
Is this more or less what you are looking for?
WCF sample for N-Tier sync between SQL Server and SQL Ce:
http://code.msdn.microsoft.com/Release/ProjectReleases.aspx?ProjectName=sync&ReleaseId=3423
Hope this helps.
Thanks,
Patrick
Tuesday, October 19, 2010 8:28 PM -
http://code.msdn.microsoft.com/Release/ProjectReleases.aspx?ProjectName=sync&ReleaseId=3423
I've already looked this example and is quite similar to what I am looking for but it is not using WCF application service. I just want to WCF do the syncronization.
Thank you for your reply.
Wednesday, October 20, 2010 3:30 PM -
you can take a look at the newly posted SQL Azure sample here : http://blogs.msdn.com/b/sync/archive/2010/10/07/windows-azure-sync-service-demo-available-for-download.aspx
it has the WCF components already, just take out the Azure WebRole/WorkerRole components.
Wednesday, October 20, 2010 3:55 PM -
I think that it should be easier. With version 2.0 the whole code for the syncronization is created using the assitant.
http://www.codeproject.com/KB/smart/sync_services.aspx
Why is this not possible in 2.1?
Wednesday, October 20, 2010 5:03 PM -
the code you cited above is using a different provider. The Local Database Cache Designer/Wizard uses the offline providers which out-of-the-box only supports SQL CE on the client (there is a sample SQL Express provider sample however). It's not really a v2.0. specific functionality but since v1.
The changes in v2.1 is more on the collaboration/peer-to-peer providers. You can still use the Local Database Cache designer, but there is nothing new in v2.1 for the providers that it uses other than improved support for the latest SQL CE Service pack that exposes the SQL CE change tracking.
- Proposed as answer by Sid Singh [MSFT]Microsoft employee Friday, October 22, 2010 8:15 PM
- Marked as answer by Dong CaoMicrosoft employee Wednesday, October 27, 2010 4:49 PM
Wednesday, October 20, 2010 5:25 PM