locked
Sync sqlexpress clients RRS feed

  • Question

  • I've a central SQL server database, my solution has a WCF service responsible for synchronizing data with clients running sql server or sql server express, the service uses microsoft sync framework and it works well,but, the sync framework requires a direct connection to my client's server but, clients who are running sql server express may not have a static ips to let my application locate them. how can I overcome this problem,is sync framework has an intermediate service that can exchange datasets of changes on both server and client? or can I use the sync frame work to get datasets of changes?
    Wednesday, June 9, 2010 8:21 PM

Answers

  • if the WCF is on the server and is the one connecting to the server DB, the client doesnt need to know where it is connecting.

    in typical two way sync using wcf, the process would be:

    1. client enumerates changes on its side by connecting to its local database

    2. client passes the changes and other metadata to WCF proxy

    3. WCF service receives changes and metadata, connects to its database and applies the changes, then retrieves changes on its side and sends it back to the client via WCF as well.

    4. The client receives changes from Server via WCF and applies the changes on its own database.

    have a look at the sample codes using WCF at this site: http://code.msdn.microsoft.com/sync

     

    • Marked as answer by Hadad1 Sunday, June 13, 2010 12:01 PM
    • Edited by JuneT Sunday, June 13, 2010 12:48 PM
    Sunday, June 13, 2010 11:49 AM
  • the Database Sync - SQL Server and SQL Express (https://code.msdn.microsoft.com/Release/ProjectReleases.aspx?ProjectName=sync&ReleaseId=3762) would be a good start.

    you dont have to explicitly enumerate the changes and send them yourself, Sync Fx can very much do that for you. What you need is to configure Sync Fx to call a WCF-based remote provider.

    • Marked as answer by Hadad1 Sunday, June 13, 2010 12:55 PM
    Sunday, June 13, 2010 12:52 PM
  • yes, you can disable the batching if you have small batches.
    • Marked as answer by Hadad1 Monday, June 14, 2010 11:02 AM
    Monday, June 14, 2010 10:40 AM

All replies

  • just a quick clarification, is it the server pushing out the changes to the clients? where is the WCF service and who initiates the sync?
    Thursday, June 10, 2010 12:37 PM
  • The WCF service is on the server,client initiates the call, the sync direction is two way server sends data to client and client sends data to server
    Thursday, June 10, 2010 1:31 PM
  • What is the way you connect to the SQL Express on the client and manipulate the data on the SqL Express? You mentioned your application can not locate them with static ip. Is it possible to use server name to connect? 

    Thursday, June 10, 2010 5:25 PM
    Answerer
  • if the client is initiating the call and you configured the sync following the docs, your server is not connecting to your client. the client retrieves the changes by connecting to the server, retrieves the changes and applies it to itself and not the server retrieving the changes and applying the changes by connecting to the client.

    or maybe am missing something? are you connecting to your client for other purposes than sync?

    Sunday, June 13, 2010 5:43 AM
  • I am connecing to my client only to sync but te problem is, if the client connects to he server, server credentials must be sent to client to connect and tis is unsecure and rejected by server administrator.

    if server connects to client my app may not located the client server. so I want a middle tier that collects the changes from the server and sends it to client to be applied and the reverse.

    Sunday, June 13, 2010 11:17 AM
  • if the WCF is on the server and is the one connecting to the server DB, the client doesnt need to know where it is connecting.

    in typical two way sync using wcf, the process would be:

    1. client enumerates changes on its side by connecting to its local database

    2. client passes the changes and other metadata to WCF proxy

    3. WCF service receives changes and metadata, connects to its database and applies the changes, then retrieves changes on its side and sends it back to the client via WCF as well.

    4. The client receives changes from Server via WCF and applies the changes on its own database.

    have a look at the sample codes using WCF at this site: http://code.msdn.microsoft.com/sync

     

    • Marked as answer by Hadad1 Sunday, June 13, 2010 12:01 PM
    • Edited by JuneT Sunday, June 13, 2010 12:48 PM
    Sunday, June 13, 2010 11:49 AM
  • thanks for help,

        the pattern you explained is typically what I want to do,

         but what sample acheives your pattern most of the samples uses the

    SyncOrchestrator class that must accept a local and remote providers with a sql connection, how can I locate changes and send them to service and the reverse,then how can I apply them separatly with no need to the SyncOrchestrator .

    Sunday, June 13, 2010 12:41 PM
  • the Database Sync - SQL Server and SQL Express (https://code.msdn.microsoft.com/Release/ProjectReleases.aspx?ProjectName=sync&ReleaseId=3762) would be a good start.

    you dont have to explicitly enumerate the changes and send them yourself, Sync Fx can very much do that for you. What you need is to configure Sync Fx to call a WCF-based remote provider.

    • Marked as answer by Hadad1 Sunday, June 13, 2010 12:55 PM
    Sunday, June 13, 2010 12:52 PM
  • thanks alot,

        The sample ueses batching to achevie the task. The service provider (the remote provider) downloads patch files to the local provider which applies them to its database then it uploads its changes to the remote provider to apply them. Each provider will work in its location the service will download or upload cahanges.

           Is that true and will achieve the patern ?

                           Thanks.

    Monday, June 14, 2010 9:06 AM
  • yes, you can disable the batching if you have small batches.
    • Marked as answer by Hadad1 Monday, June 14, 2010 11:02 AM
    Monday, June 14, 2010 10:40 AM
  • I've studied the sample but by the end it calls the SyncOrchestrator class that must accept two providers with a full connection string, my only problem is that I'm prevented from sending my SQl server credentials to my client. So,

    changes must be selected and applied separeatlly on the server and client with out sending any credentials from client to the server service or from the servr service to client the only allowed component to connect to server, is the WCF service , which should select and send server changes to client and recieve client changes to apply them to server in  a secure way.

    is there any solution to this case in the sync frame work?

    is offline scenarios will be the best choice?

    Monday, June 14, 2010 1:22 PM
  • Hi,

    Thanks for explaining the pattern, do you have any sample code that implement the above steps ? please share the code.

    thanks

    Tuesday, May 27, 2014 4:22 AM