My existing application is a .NET 3.0 winform app that talks to a WCF service which in turn updates a MS SQL Server database; I can make changes at all spots (Windows client, WCF, server). I've had an inquiry into the possibility of allowing users to work offline and later sync their data back up. I have concerns about stale data mostly as the data is not owned by them and another user could have updated the same record while they were offline. I also use NHibernate for my ORM.What are your thoughts as to the best implementation to add a sync feature?
Offline data that will need imported later
.net;wcf;synchronization;nhibernate
The actual logistics of this aren't too tricky (last-modified date on each record, and a disconnected-since or last-synced timestamp stored somewhere), the real issue is probably going to be your conflict resolution technique.  What should the system do when two people modify the same field in the same record?I'd suggest logging all offline changes made to the database, then try to simply replay or apply those changes the next time the user syncs up.  That's probably more efficient than simply checking each table to see if it has any changes made since the last sync time.  You could also store both the old and new values for any fields that got changed.  This would help with conflict resolution, since you could still update any fields that still contained their old values, even if the last-modified date indicated that the record had been changed.