4
votes

I'm very new to asp.net with database synchronization. Currently I'm implementing a project that required Server (SQL Server 2010) <> C# Client (SQLite) bidirenctional database synchronization using change tracking. I had go through most of the tutorial/example discussed in forums and Stack Overflow:

http://dotnetvisio.blogspot.com/2013/07/microsoft-change-tracking-sql-server.html

Syncing SQL Server 2008 Databases over HTTP using WCF & Sync Framework

http://msdn.microsoft.com/en-us/library/cc305322.aspx

http://technet.microsoft.com/en-us/library/cc280358(v=sql.105).aspx Etc...

However, I couldn't get any idea on how to implement change tracking database synchronization in between:

[SQL Sever Database with Change Tracking enable] <> [WCF Service] <> [WPF Client] <> [SQLite Local Database]

So my question is how to connect and establish the connection for synchronization with local database? A step-by-step tutorial is much appreciated. Thanks.

1
Just to be clear you are connecting two databases together directly with Sync Framework, and not going through a third party right? Your 'diagram' model is throwing me for a loopJNYRanger
Yes, database will be connected via sync framework. Sorry for confusing.BlackHat
No prob, check out my answer. Just used this for a project a few months back as my first experience with the Sync Framework. It's far easier to use than some of those articles make it out.JNYRanger
If you use SQL Server Compact on the client, it is almost trivial to implement, but if you must use SQLite then you are going to experience pain. You'll want to intercept all calls to the DB to track the Knowledge Meta Data.Timothy Walters
I found an article that talks about how to implement it in SQLite (hint: manually tracking "dirty" and "tombstone" records to tell the server about them): jtabadero.wordpress.com/2013/01/09/…Timothy Walters

1 Answers

2
votes

Assuming you are using the Sync Framework to sync two databases together directly you don't need to manually implement the change-tracking components in most situations with SQL Server and/or SQL Server Compact. The easiest way to do this is by writing a helper application that handles the scoping and provisioning of the databases for you. This will have the Sync Framework automatically create all of the change-tracking objects (Tables/Functions/StoredProcs) necessary for Sync Framework to work properly. Check out this article form MSDN: Walkthrough: Defining Scope and Provisioning

If you can't use provisioning you have some work ahead of you since you will need to write all of your own providers. It's unfortunately not as easy of a task as you'd expect and there isn't much info out there. Here are a few articles to get you started:

http://www.8bit.rs/blog/2009/05/debugging-sql-express-client-sync-provider/

MS's Response that Change Tracking & The Sync Framework are not Directly Compatible

Sync Framework Metadata Services -- This is the info on what you need to build your own providers