Syncing peer-peer between a smart device and a wcf service RRS feed

  • Question

  • Scenario:

    I have a smart device running compact framework v3.5, which has a local sdf database file on it.

    I also have a desktop/server with a local sdf database file running a WCF service.

    Sync framework is v2.

    Sync needs to be called from smart device between it and the server.

    Examples I've seen require the use of sessions, which aren't supported over basicHttpBinding on the WCF service, but this is the only type that the smart device does support.

    How can I solve this issue so that the smart device can sync with the server using WCF?

    Wednesday, April 7, 2010 4:22 PM

All replies

  • I am having the same issues as above. The example in the link is using a server/client setup.

    What we want to do is similar to the OCA diagram (http://i.msdn.microsoft.com/bb887608.Figure4(en-us).png) shown in "Introduction to Sync Framework Database Synchronization".

    It is the communication between the left most server (containing an .sdf database) and the hand held. This sync will only ever be from the hand held to the server and doesn't have to be over WCF, this just seemed like the obvious choice.

    Monday, April 12, 2010 8:13 AM
  • hi tom,

    you may want to check the sample here: http://msdn.microsoft.com/en-us/library/dd938879.aspx

    the sample uses basicHTTPBinding.

    You can't actually make a reference from your device project to the v2.0 assemblies. The synchronization support for devices is still a V1.

    The key is to modify the designer generated code so that for the server side, you query the SDF instead of SQLServer.

    • Edited by JuneT Monday, April 12, 2010 11:09 AM
    Monday, April 12, 2010 10:52 AM
  • hi ollnixon,

    as mentioned above, you can't make a reference from your device project to the SQLCESyncProvider which would have provided a peer-to-peer scenario. That means from your device, you will have to settle with the SQLCEClientSyncProvider (offline provider/OCA).

    A quick workaround (depending on the size of your SDF) is to copy the SDF to PC, sync using SQLCESyncProvider on 2.0 then copy back to the device. 

    See the SharingAppDemo-CEProviderEndToEnd (WebSharingAppDemo-CEProviderEndToEnd for n-tier)  sample that gets installed with the SDK. The catch with the sample is that the first SDF has to be provisioned off a sync scope definition from SQLSyncAdapter. Once you have provisioned your first SDF, you can generate the subsequent SDFs using snapshot generation (SqlCeSyncStoreSnapshotInitialization). You can then do an SDF to SDF synchronization.


    • Proposed as answer by Jandeep Thursday, April 29, 2010 11:50 PM
    Monday, April 12, 2010 11:06 AM