I am new to Sync Framework. This is using version 2.1
My project involves syncing a SQL CE to SQL Azure (soon to be SQL Server 2008)
Right now I am working with a very simple synchronization plan. I want to upload all data in records from Claims and related table Inventory to SQL Azure where the Claims.Status = ‘Closed’. That’s all I want for now and I’ve seen it work, but then it won’t work. I see no error messages and I don’t know what it’s doing. I’ve tried the tracing tool and the results are in Greek and as far as I can tell it doesn’t mention anything about the data
Here is an excerpt of the code in a Windows Console App:
//For Provisioning...
myScope.Tables.Add(Claims);
myScope.Tables.Add(Inventory);
SqlSyncScopeProvisioning sqlAzureProv = new SqlSyncScopeProvisioning(sqlAzureConn, myScope);
sqlAzureProv.Tables["Claims"].AddFilterColumn("Status");
sqlAzureProv.Tables["Claims"].FilterClause = "[side].[Status] = 'Closed'";
sqlAzureProv.Apply();
//For the client...
DbSyncScopeDescription clientSqlCeDesc = SqlSyncDescriptionBuilder.GetDescriptionForScope(myScope.ScopeName, null, "dbo", sqlAzureConn);
SqlCeSyncScopeProvisioning sqlCeProv = new SqlCeSyncScopeProvisioning(sqlCeConn, clientSqlCeDesc);
sqlCeProv.Apply();
//For Syncing:
SqlCeConnection sqlCeConn = new SqlCeConnection(sqlCeConnectionString);
SqlConnection sqlAzureConn = new SqlConnection(sqlazureConnectionString);
SyncOrchestrator orch = new SyncOrchestrator
{
RemoteProvider = new SqlSyncProvider(scopeName, sqlAzureConn),
LocalProvider = new SqlCeSyncProvider(scopeName, sqlCeConn),
Direction = SyncDirectionOrder.Upload
};
Console.WriteLine("ScopeName={0} ", scopeName.ToUpper());
Console.WriteLine("Starting Sync " + DateTime.Now);
ShowStatistics(orch.Synchronize());
As for the data on the local and remote dbs, there is one more ‘Closed’ record on the Local db than there is on the Remote db. I de-provisioned and provisioned to refresh it. Then when I sync, the results shows 38 changes and I don’t know what data changes but I do know that the one record that should be updated as ‘Closed’ is still open.
I’ve seen this work where I updated two records to be closed on the CE, ran the sync and it syncs. I tried it again with another record and this is what happened. I just want to see consistent results. What am I missing?
I apologize to anyone who spent time looking at this post. It was a misunderstanding that I had about how Sync Framework worked. I learned today that static-filters will not propagate changes to existing/tracked records, they will only Insert new records. Sync Framework is far more smooth and much more complicated than I have been giving it credit. I just needed to do more reading and researching.
Special thanks to JuneT, not only for your responses but for the wealth of info that I found on other sites that you have been involved with. Also thanks to anyone else who spent time looking at this post.