views:

501

answers:

1

Microsoft Sync Framework with SQL 2005? Is it possible? It seems to hint that the OOTB providers use SQL2008 functionality. I'm looking for some quick wins in relation to a sync project. The client app will be offline for a number of days. There will be a central server that MUST be SQL Server 2005. I can use .net 3.5.

Basically the client app could go offline for a week. When it comes back online it needs to sync its data. But the good thing is that the data only needs to push to the server. The stuff that syncs back to the client will just be lookup data which the client never changes. So this means I don't care about sync collisions.

To simplify the scenario for you, this smart client goes offline and the user surveys data about some observations. They enter the data into the system. When the laptop is reconnected to the network, it syncs back all that data to the server. There will be other clients doing the same thing too, but no one ever touches each other's data. Then there are some reports on the server for viewing the data that has been pushed to the server. This also needs to use ClickOnce.

My biggest concern is that there is an interim release while a client is offline. This release might require a new field in the database, and a new field to fill in on the survey. Obviously that new field will be nullable because we can't update old data, that's fine to set as an assumption. But when the client connects up and its local data schema and the server schema don't match, will sync framework be able to handle this? After the data is pushed to the server it is discarded locally.

Hope my problem makes sense.

+1  A: 

I've been using the Microsoft Sync framework for an application that has to deal with collisions, and it's miserable. The *.sdf file is locked for certain schema changes (like dropping of a column, etc.).

Your scenario sounds like the Sync Framwork would work for you, out of the box... just don't enforce any referential integrity, since the Sync Framework will cause insert issues in these instances.

As far as updating schema, if you follow the Sync Framework forums, you are instructed to create a temporary table the way the table should look at the end, copy your data over, and then drop the old table. Once done, then go ahead and rename the new table to what it should be, and re-hookup the stuff in SQL Server CE that allows you to handle the sync classes.

IMHO, I'm going to be working on removing the Sync functionality from my application, because it is more of a hinderance than an aid.

Richard B
Thanks, appreciate the feedback. Also I found out ClickOnce will auto update your schema, regardless of sync framework or not. In my case I only add new nullable fields on central server so this works could work quite well for me
DarkwingDuck
How does ClickOnce wind up auto-updating the database? I haven't yet seen this scenario, and I am quite intrigued.
Richard B
So what I found was that ClickOnce will deploy only SOME changes safely to your compact database. For example, removing a column worked fine. However adding a column actually caused all the local data to get nuked. So what I did instead was during the 'sync' process I let the app post its data, and THEN call the System.Deployment.CurrentDeployment class which has static methods to Update your deployment. This worked a treat for me. But it may not work so well if you use WCF as a proxy to your database (which is a supported Sync framework scenario) since you need to version your contracts.
DarkwingDuck
OK.. that's why I couldn't understand what you were talking about... I'm exclusively using WCF for the synchronization, because the tool I'm working on is meant for remote users. I cannot expect a crew of office workers to be able to setup sql server replication, so my best option was to use sync services, and then handle it. I've since learned that not believing part of the time in NIH is a bad thing, and I'm going to start to subscribe to the attitude for background stuff (like sync services) -> NIH = Not In House.
Richard B
My hope is to eventually use some of the new gadgets that are coming from Microsoft to be able to have a Silverlight version of the app, as well as a more robust "pro" version that is an installable application in WPF... but being one developer, one step at a time for now.
Richard B

related questions