Tutorial :Can I sync mobile, desktop and web server databases with Sync Framework?



Question:

I'm using Sync Framework v1 (which includes Sync Services for ADO.NET v2) and Sync Services for mobile v1.

I can sync a SQL Compact Edition database from a mobile device to SQL Express on a desktop PC.

I can also sync a SQL CE database from a desktop PC to a SQL Server database on a web server using WCF.

I want to sync from the mobile device to the desktop when it docks, and then have the desktop PC sync with the web server (the copy on the desktop machine is in case the web connection is unreliable).

Ideally, I'd like to avoid SQL Express anyway because I want the mobile & desktop setups to be as simple as possible.

Unfortunately, it looks like there's no way to fit these pieces together to make the connections I need because:

  1. The mobile device syncs to SQL Express on the PC, and I can't sync from SQL Express to SQL server.
  2. Syncing to SQL server has to come from SQL CE, and I can't sync the mobile device to SQL CE on the desktop

Is this just not possible, or possible with a large amount of code (custom SyncProviders and hand-crafted update statements etc), or have I missed something obvious?

Thanks for your time! Mark.


Solution:1

I am using the same basic setup for a live application and it is working pretty well. I have the mobile device sync with the server using web services (WCF would also be fine) and I have the desktop app syncing somewhat like this and everything works really smooth.

Generally it would be a bad idea to have a client sync with a server who then syncs with a server because then you have to manage more state and the common tools and guides will not help you much.

I would also recommend against using sql merge replication unless you consider yourself an expert at managing SQL, because if you are not one now you will be one by the time you feel safe using it.

As a note, if you are willing to spend the time and effort in making your own Sync Framework providers, then you will find there is little you cannot do.


Solution:2

I suppose the 'intended' pattern would be to use SQl Express on the desktop and use merge-replication to the server.

I don't expect that you can use SqlCe on the desktop as the 'server' end for the Sync framework. Amongst others, SqlCe is single user and that won't do for the SyncAgent. Even if it might seem workable in your situation.

What might work is to have the Mobile sync with the server and the desktop with the server too. But i realize that doesn't solve your connection problem and may make the copy on the PC superfluous.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »