locked
How-to modify the FilterClause of an already existent Scope? RRS feed

  • Question

  • Hello,

    I am learning the ropes of Microsoft Sync Framework, and have a question.

    For the sake of simplicity, let's say I have a table called [Project] in SQL Server with the following structure:

    [Project].[ProjectId] (PK, UID)
    [Project].[Name] (varchar)
    [Project].[Leader] (varchar)

    I create an Scope called 'filtered_project', which then I add the following filter:

    sqlSyncScopeProvisioning.Tables["Project"].AddFilterColumn("Leader"); sqlSyncScopeProvisioning.Tables["Project"].FilterClause = "[side].[Leader] = 'John Smith'";

    So far this Scope works just great. It successfully synchronizes all projects in the table whose leader is "John Smith". However let's suppose now I want to synchronize all projects whose leader is "Mary Sue", and then "Dave Roberts", and so forth.

    Do I need to create a scope for each one of my 500 project leaders in the corporation? Can't I modify the existing one (filtered_project) so it filters by different leaders on demand?

    I tried to modify the FilterClause of an existing Scope, but it didn't work. I had to destroy and then re-create the scope in order to get it reflecting the current FilterClause. This could be cumbersome, since there is no way the framework can manage existing Scopes, and I believe that re-creating the same scope erases all tracking information.

    Thanks.

    Friday, June 25, 2010 2:31 PM

Answers

All replies

  • unfortunately, you cant modify nor delete an existing scope definition. you may check out a workaround here: http://jtabadero.spaces.live.com/blog/cns!BF49A449953D0591!1187.entry

    hth

    • Proposed as answer by realtn Saturday, June 26, 2010 4:49 PM
    • Edited by JuneT Sunday, June 27, 2010 11:45 PM
    • Marked as answer by Dauphin bleu Monday, June 28, 2010 2:40 PM
    Friday, June 25, 2010 3:20 PM
  • Hello June,

    Thank you for the answer. Can I contact you to further exchange some thoughts?

    Best regards.

    Sunday, June 27, 2010 10:44 PM
  • i think i may have added your request on Live Messenger already.

    Sunday, June 27, 2010 11:46 PM
  • June,

    Do you know of any issue of using your dynamic filters approach with a n-tiered architecture?

    Wednesday, July 7, 2010 6:35 AM
  • not that am aware of. the filtering is applied at the database level and has nothing to do with the number of tiers.
    Wednesday, July 7, 2010 10:48 AM
  • Great!

    I'm building a solution over a n-tier architecture using your dynamic filtering aproach. I'll post it here once is finished.

    Best regards.

    Wednesday, July 7, 2010 2:15 PM