Παρασκευή, 4 Μαρτίου 2011 - Δημοσιεύσεις

Synchronising two folders using Microsoft Sync Framework using less than 10 lines of code

I remember that long time ago I wrote my own synchronisation class in order to sync folders for the needs of a project I was working on. I'm sure many of you have done something similar. Like me, maybe some of you even enjoyed writing that code. But now Microsoft Sync Framework is here! And the job is sooooo easy! Take a look at the code:

var provider1 = new FileSyncProvider(@"C:\Temp\FolderA"); var provider2 = new FileSyncProvider(@"C:\Temp\FolderB"); provider1.DetectChanges(); provider2.DetectChanges(); var agent = new SyncOrchestrator {     LocalProvider = provider1,     RemoteProvider = provider2,     Direction = SyncDirectionOrder.DownloadAndUpload }; agent.Synchronize();

What is Microsoft Sync Framework?

From MSDN: A comprehensive synchronization platform that enables collaboration and offline access for applications, services, and devices with support for any data type, any data store, any transfer protocol, and any network topology.

Permalink | Leave a comment  »