Answered by:
synchronize to sql server 2008 databases using wcf

Question
-
Hello I made a sample that is able to synchronize between sql server 2008 and SDF local database but I just wanted to change the client side
part of this sample to be able to use sql server 2008 in local side ?
what is the main step for that .
here is some code that trigger the synchronization
ServerSyncServiceProvider serverProvider = new ServerSyncServiceProvider(Properties.Settings.Default.Server_WarehouseDBConnectionString); SqlSyncProvider localprovider = new SqlSyncProvider("" , new SqlConnection(Properties.Settings.Default.Client_WarehouseDBConnectionString)); SyncOrchestrator sync = new SyncOrchestrator(); sync.RemoteProvider = serverProvider; sync.LocalProvider = localprovider; sync.Direction = SyncDirectionOrder.Download; SyncOperationStatistics stats = sync.Synchronize();
of course I'm using wcf service to call the remote database server
and locally i'm just using an SqlSyncProvider that connect to sql server 2008
but I got this exception :
InvalidCastException Was not unhandled: Microsoft.Synchronization.KnowledgeSyncProvider
!!!
- Edited by Feras mazenTaleb Wednesday, December 8, 2010 2:09 PM clear my idea more
Wednesday, December 8, 2010 12:03 PM
Answers
-
the tracking table contains the tombstones as well. the trackings contains the change tracking information so it will have a row for each row in the base table so Sync Fx can determine if a row has been inserted/updated/deleted. the tracking table is populated by triggers on the base table.
- Marked as answer by Feras mazenTaleb Tuesday, December 14, 2010 1:16 PM
Monday, December 13, 2010 3:18 PM -
check How to: Clean Up Metadata for Collaborative Synchronization (SQL Server) in the docs as well as the Tuning and Monitoring Performance topic.
- Marked as answer by Feras mazenTaleb Wednesday, December 15, 2010 10:39 AM
Tuesday, December 14, 2010 3:18 PM
All replies
-
is ServerSyncServiceProvider a custom provider? if you're synching both SQL Server 2008 on server and client, why dont you just use SqlSyncProvider on both sides?Wednesday, December 8, 2010 3:15 PM
-
ServerSyncServiceProvider
public partial class ServerSyncServiceProvider : Microsoft.Synchronization.Data.Server.DbServerSyncProvider
I created LocalDataCache File and this class generated but then I wanted to use it to synchronize with sql server database not SDF file
so I tried to modify the code as the question above ,,,, anyway ,, could you give some sample in how to use SqlSyncPRovider in both sides
and I would like to remind you that I call the Server side by using WCF
thanks a lot ,
Thursday, December 9, 2010 7:38 AM -
ok finally I got some samples and I've started understanding the case in general thanksThursday, December 9, 2010 9:57 AM
-
good to hear you've made some progress.
the Local Database Cache uses a different provider and you cant mix and match the offline provider (SqlCeClientSyncProvider/DBServerSyncProvider) and the collaboration provider (SqlCeSyncProvider/SqlSyncProvider)
the documenation actually has step-by-step tutorials on both type of providers.
- Proposed as answer by Ganeshan Thursday, December 9, 2010 5:44 PM
Thursday, December 9, 2010 1:17 PM -
finally I have a big achievement I modified this sample to fit my needs
http://code.msdn.microsoft.com/sync/Release/ProjectReleases.aspx?ReleaseId=3762
but I noticed something strange for me ! : tracking table contains the same number of rows for the relative data table .
I'm still beginner so I don't know why and when I configured the local database and server database for the first time , no Thumbstone tables created ?
Monday, December 13, 2010 12:10 PM -
the tracking table contains the tombstones as well. the trackings contains the change tracking information so it will have a row for each row in the base table so Sync Fx can determine if a row has been inserted/updated/deleted. the tracking table is populated by triggers on the base table.
- Marked as answer by Feras mazenTaleb Tuesday, December 14, 2010 1:16 PM
Monday, December 13, 2010 3:18 PM -
- well thanks for this information but don't you think that this will cause to enlarge the size of the database in all sides (server , clients ) and is there any optimization tips when using it with Sql server 2008 of course I don't want to use other sync frame work techniques I mean I have to use the change tracking tables and the provisioning sync classes in general
exactly like this famous sample : http://code.msdn.microsoft.com/sync/Release/ProjectReleases.aspx?ReleaseId=3762
Tuesday, December 14, 2010 1:19 PM -
check How to: Clean Up Metadata for Collaborative Synchronization (SQL Server) in the docs as well as the Tuning and Monitoring Performance topic.
- Marked as answer by Feras mazenTaleb Wednesday, December 15, 2010 10:39 AM
Tuesday, December 14, 2010 3:18 PM -
I am facing the same issue, can you elaborate what really helped you solving the InvalidCastException because that sample link is no longer accessible. Note that I am also using WCF proxy in n-tier configuration.
- Edited by Furqan.Safdar Saturday, April 28, 2018 7:26 PM
Saturday, April 28, 2018 7:25 PM