N-tier sync framework with filtering RRS feed


All replies

  • have you decided on which database provider to use?

    here's two samples using SqlSyncProvider/SqlCeSyncProviders over WCF




    if you want the Local Databas Cache generated code, have a look at this:



    Thursday, November 24, 2011 2:07 AM
  • Hi,


    thanks for the help! I managed to do following things:

    • separate client and server side
    • connect the client to the WCF service of the server
    • syncronize data

    What I need now is the filtering. So far i've done following things: (basicly: http://msdn.microsoft.com/en-us/library/ff928701%28v=SQL.110%29.aspx just with sql compact for the client)

    • write a separate program to provision the client (sql compact database) and the server
    • in the sepatate program I created a filtered scope
    • in my main program in the client i managed to execute:


    syncOrchestrator = new SampleSyncOrchestrator(
    new SqlSyncProvider("RetailCustomers", clientSqlConn, null, "Sync"),
    new SqlSyncProvider("RetailCustomers", serverConn, null, "Sync")
    syncStats = syncOrchestrator.Synchronize();


    syncStats says, that I have downloaded one table.

    Whats missing:

    • update my Entity Model based on my sql compast sdf database

    How can I do that? I've tried EntityContext.Refresh(StoreWins, entity table), but nothing happended.


    Can you help me with this?


    Thanks a lot!


    • Edited by goja15 Thursday, November 24, 2011 3:18 PM
    Thursday, November 24, 2011 3:16 PM
  • are you just trying to save something to your table? or are you trying to use EF to do the conflict handling?
    Thursday, November 24, 2011 11:46 PM
  • Hi,


    I have the following tasks with the program:

    • create a local database that conatins only a fragment of the server database, so i must use multiple dynamic parameter filters
    • use the local database, import data, and syncronize it back to the server

    Problems that I could not solve so far:

    • I started SyncFramework with the "add new item - local database cash" in VS and created an ADO.NET Entity framework model on it. This works fine, but it provides no filtering. I created code for filtering the database, but then I could not use the Entity model with it. Is it even possible? because if i use filter, only a subset of th tables and data will be available on the client, that means the Entity model would have to be generated dynamicly.
    • I did not manage to deprovision the server - it always says, that is it not ywt provisioned. I use this code for provisioning:

     SqlSyncScopeProvisioning serverTemplate = new SqlSyncScopeProvisioning(serverConn, scopeDesc, SqlSyncScopeProvisioningType.Template);
     serverTemplate.ObjectSchema = shemaName;

    • create multiple filters - I only managed to create one filter so far, If i try to create a second one, exception come all over

    What do i do wrong?




    Friday, November 25, 2011 8:56 AM
  • the Local Database Cache uses a different set of providers: SqlCeClientSyncProvider/DbServerSyncProvider and is provisioned differently.

    the ScopeProvisioning APIs works with SqlSyncProvider/SqlCeSyncProvider.

     likewise, Sync Framework does not support dynamic filtering.

    you might want to go thru the tutorials in the documentation that comes with the framework or check them online:


    Friday, November 25, 2011 5:22 PM
  • Does that mean, that Local Database Cache does not support filternig?

    I'd need the easyness of Local Database Cash, with it's WCF suppor combined with filtering.

    Is this somehow possible?

    If Filtering only works with ScopeProvisioning than how can I achieve that combined with WCF services?

    So basicly i'd need an N-Tier applicartion with WCF support with local database cache AND filtering.



    • Edited by goja15 Friday, November 25, 2011 11:13 PM
    Friday, November 25, 2011 11:11 PM
  • the Local Database Cache Wizard itself doesnt support filtering. but you can modify the code after its generated to add the filters.

    see: http://jtabadero.wordpress.com/2010/03/17/adding-filter-to-local-database-cache-generated-sync/

    if you're using WCF, you will have to add the filter in the WCF service code.

    Saturday, November 26, 2011 1:07 AM
  • Hi,


    thanks for the help! I've tried your last link, it is also good, but i've found an even simpler and with that it works:



    Thanks for your help so far again!

    • Marked as answer by goja15 Sunday, November 27, 2011 11:22 AM
    Sunday, November 27, 2011 11:22 AM
  • Here is another complete solution for N tier Sync over WCF,including central portal code for sync configuration..



    Rajnish Noonia

    Friday, March 30, 2012 10:16 PM