none
Issues with multiple scopes/filters. RRS feed

  • Question

  • I've been working on converting an old application of ours over to Microsoft's Sync Framework.  The application is pretty simple but we have several users accessing the data and I've hit a road block with how to handle the scopes and filters necessary to make things work.

    All our customer data is gathered up in a SQL Server 2008 database.  Each of our users will have the application installed on their laptops with a SQL Express database (ran into too many issues with SQL Compact and had to go with Express).  These users need access to only the customers in their sales area.  So a user in California should not sync data for customers in Kansas.  Pretty logical, right?

    However, I created a filtered scope for user1 on a table called OW_CUSTOMERS.  The scope (which I called OW_CUSTOMERS_USER1) has the following filter:

    <FilterClause>[side].[STATE] = 'KS' or [side].[STATE] = 'NE'</FilterClause>
    <FilterCol>STATE</FilterCol>

    I've run several tests and everything is working great.  I then added user2 to the application.  This user is my California user, so I created another scope (called OW_CUSTOMERS_USER2) with the following filter:

    <FilterClause>[side].[STATE] = 'CA'</FilterClause>
    <FilterCol>STATE</FilterCol>

    Now, whenever I sync this user he gets all the data for KS and NE but nothing for CA.

    I'm sure I'm probably missing something very simple or overlooked another limitation to the sync framework, but I appreciate any guidance that can be offered.

    Monday, January 28, 2013 4:57 PM

Answers

  • can you check how many SelectChanges stored procedure do you have? 

    did you set the SetCreateProceduresForAdditionalScopeDefault in the second scope? if you didn't, chances are you only have one SelectChanges stored proc, the first one and your second scope is re-using that.

    • Marked as answer by The_Big_Steve Friday, February 1, 2013 7:12 PM
    Tuesday, January 29, 2013 1:13 AM
    Moderator

All replies

  • can you check how many SelectChanges stored procedure do you have? 

    did you set the SetCreateProceduresForAdditionalScopeDefault in the second scope? if you didn't, chances are you only have one SelectChanges stored proc, the first one and your second scope is re-using that.

    • Marked as answer by The_Big_Steve Friday, February 1, 2013 7:12 PM
    Tuesday, January 29, 2013 1:13 AM
    Moderator
  • JuneT,

    That was it.  I wasn't aware of the SetCreateProceduresForAdditionalScopeDefault.  A quick Google search and I stumbled across this blog post:

    PROVISIONING ADDITIONAL SCOPE USING SYNC FRAMEWORK’S SYNC SCOPE PROVISIONING

    In fact, I've read a few of the posts on that blog and have found answers to a couple different questions I was having.

    Thanks for the help.

    Friday, February 1, 2013 7:12 PM