Freigeben über


New Code Sample: Database Sync - SQL Server and SQL Server Express

With the recent release of Sync Framework 2.0, we have added the ability to target SQL Express on the client. For many developers, there are a handful of features such as stored procedures, XML support, and advanced profiling capabilities that are must-haves. For certain scenarios, these needs outweigh some of the benefits provided by SQL Compact, such as friction-free deployment and an extremely lightweight footprint. This sample demonstrates how you go about leveraging SqlSyncProvider for both the client-side database and the server. Also note that the sample leverages WCF as the transport layer, although a 2-tier architecture is fully supported as well. Special thanks to Dong Cao for writing this sample. Dong is one of our test leads and has been working in the sync space since the WinFS days. Enjoy!

The sample can be found here:

https://code.msdn.microsoft.com/Release/ProjectReleases.aspx?ProjectName=sync&ReleaseId=3762

Sean Kelley

Comments

  • Anonymous
    February 25, 2010
    We are currently using a Dynamics AX partner product called FSA from Hitachi Consulting.  The software requires the database to be sync'd from the main server to each laptop.  The 700+ laptops are feild service technicians that have wireless mobile cards.  Our problem is that syncing the database (currently around 100mb) in size gets difficult.  Currently Hitachi has a custom way of syncing the data by sending all the keys to the server, doing a compare, and then sending updated rows back to the laptop. Now my question is, does the Sync framework support such a distributed without overwhelming the server of sending massive amounts of data to the client? thanks, Kevin

  • Anonymous
    July 22, 2010
    How can I create multiple filters for userA/B/C...? Here is my code: ... string scopeName == "UserA";// or userB, etc. It will be changed. DbSyncScopeDescription scopeDesc = new DbSyncScopeDescription(scopeName); SqlSyncScopeProvisioning serverConfig = new SqlSyncScopeProvisioning(); if (!serverConfig.ScopeExists(scopeName, connServer)) { scopeDesc.Tables.Add(SqlSyncDescriptionBuilder.GetDescriptionForTable("Table", connServer)); serverConfig.PopulateFromScopeDescription(scopeDesc); serverConfig.SetCreateTableDefault(DbSyncCreationOption.Skip); serverConfig.Tables["Table"].AddFilterColumn("name"); serverConfig.Tables["Table"].FilterClause = "[side].[name] = '" + scopeName + "'"; serverConfig.Apply(connServer); } ... At the first time it always works well. But if I change the scopeName's value, there will be a exception "..._tracking tables already exist".

  • Anonymous
    July 22, 2010
    social.msdn.microsoft.com/.../d8feb7d5-d148-48db-b5df-8b0e796e0597 I have got an answer from there!