Is it possible to use Microsoft Sync Framework and sync through FTP-transfers? RRS feed

  • Question

  • I'm looking at synchronize methods between two databases and found Microsoft Sync Framework recently. I've been trying to investigate if it suits my needs but finding it difficult to find any information regarding my needs.

    My scenario is the following:

    Two SQL-databases located in different geographical parts. The remote database can go without internet connection for days at times and for some locations the only means of communicating is with ftp transfers to the main server.
    The data transfer may in some cases not be orchestered by our application but a server that decides it selfs at which times it will transfer the files and fetch new ones from the central server.

    So my question is: Is it possible to sync between two servers and send the sync-information and data in files.
    And it can take some time before the application knows if the sync has been successful and takes necessary actions on the local database.

    Wednesday, September 1, 2010 9:22 AM

All replies

  • if you're looking at the File Sync providers, afaik, they dont support FTP out of the box.

    just to clarify, is it the database files (MDFs) that you want synchronized or the contents of the database?

    if its the latter, the Sync Fx database sync providers can synchronize data changes (insert/updates/deletes) over WCF and IMHO is a much efficient solution transferring only data changes rather than the physical files.

    Thursday, September 2, 2010 12:52 AM
  • Hi June!

    Ok, to clarify it the procedure would be the following:

    1. A user invokes a synchronization in the Client Application.

    2. The data changes (inserts/updates/deletes) are fetched from the db processed according to business rules and then put in some kind of data file.

    3. The data file is sent through ftp to the main server or put in a waiting list for sending later on through some kind of file transfer protocol that my application has no control over.

    4. When the server notices a new data file it processes it and sends back a respone.

    And also vice versa.

    WCF is not possible.


    Friday, September 3, 2010 7:41 AM
  • you may to build your own custom providers for your scenario.

    Sync Fx uses the concept of providers which manages the connectivity to the store, enumerating and applying changes and keeping track of metadata to indicate what was sent and what was received.

    The out of the box provider for File Sync doesnt work on FTP (even on WCF) so you can't use it out of the box. And the File sync provider only takes care of synching the files, not applying the file changes to the database.  Also, you would need a provider to dump the changes to a data file and read the data file and apply it to SQL server.

    The closest i could think of for you is to get your client application to generate some kind of an XML file, have it uploaded with FTP or whatever means, thenn have a server application pick up the contents of the XML file and apply the changes to the database.

    In this case, you can have Sync Fx do the XML to SQL sync. The catch is, there is no XML provider either (only a sample XML provider).

    So you can use Sync Fx on both client and server. On the client you can use Sync Fx to enumerate the changes from the client database and dump it to an XML file and have the transfer mechanism pick it up. On the server side, you can have a server app to pick up the XML and apply it to the server DB.

    Friday, September 3, 2010 8:11 AM
  • hi june,

    Do you have a sample for ntier synchronization with sync version 2.1 which have filter templates and no tracking tables required.

    I tried downloading the sample application from the below link but it's giving compile time errors.



    It seems the demo hasnt been updated with new sync framework 2.1 as it's not able to find many methods in new sync dlls.



    Amit S

    Friday, September 3, 2010 9:52 AM
  • Ok, yes I realize would have to write some custom providers if it was possible.

    Do you think that Sync Fx allow this scenario:

    1. Client starts a sync, package the xml file with changes. 
    2. Sends the package to the server
    3. The server app is offline or off some reason doesn't process the package until X hours has gone.
    4. Client gets the response after X hours and finishes the sync.

    So during those hours if a Client starts a sync again, the previous unfinished sync is "deleted" or something and a new package with the latest changes is prepared (including the ones in the prev. sync.).

    We would want a two-step sync, client sends a package, the server processes it and sends a response package and that's it. The sync is finished. And vice versa.
    So only two seperate data transfers.


    Amit, is that sample something that could help me on my way?

    Friday, September 3, 2010 10:41 AM
  • Amit,

    The SqlSyncProvider/SqlCeSyncProvider requires tracking tables. if you want to use SQL Change tracking, you  can opt for the offline providers SqlCeClientSyncProvider/DbServerSyncProvider (you can use the Local Database Cache project item). However, there is no  offline client provider for SQL Express other than a sample one.

    afaik, the sample above has been updated already to Sync Fx 2.1. it will be helpful if you post the exact compile error you're getting.


    kindly open up a new thread if you have a different question than the current thread.


    Friday, September 3, 2010 2:18 PM
  • you will have to build your XML provider.

    just a wild idea, Sync Fx uses datasets. assuming you use the offline provider (you'll have to settle for the sample SQL express provider if your client is SQL Express) you can try playing around getting Sync Fx to retrieve the changes and saving the dataset to a file instead, you transfer it, then on the server side, open the dataset file and feed it to Sync Fx and the same process on the way back.

    you might just get away not writing a provider.


    Friday, September 3, 2010 2:26 PM
  • Matt,


    Did you ever get anywhere setting this scenario up? I have a similar problem and could use any additional information you've found.




    Alex C.

    Monday, January 3, 2011 9:47 PM