Beginner Question about LocalDataCache's RRS feed

  • Question

  • I've just started using the Sync Framework (v2) so please forgive my ignorance. After much reading and following some tutorials I've managed to create an application by adding a LocalDataCache, then managed to convert it to an n-tier variety, admittedly most of this was though "Configure Data Synchronization", but it does work - yippee!  Now what I would like to do is filter the data coming from the server, so my client database only contains a subset of data relevant to itself, I've read through the "How to: Filter Rows and Columns" several times, but am a bit confused, am I supposed to edit the "sync" file it generated? this doesn't seem correct because if I then edit the configuration, any code changes get erased, so presumably only edit the OnInitialised() subroutine? Are there any examples which have used LocalDataCache as a basis? or am I doing things completely wrong by even using it?


    Tuesday, July 14, 2009 3:34 PM


  • Hello
    1. For column filtering, all you need to do is to modify the generated TSQL command from the sync adapter.  You can specify the column name in the SELECT statement.
    2. For row filtering, (which is independent of column filtering) you will also need to modify the SELECT statement with the filtering criteria such as STATE='WA' or age > 15.  If you need to go with dynamic filter (which is not fixed by 'WA' or 15), then you need to have a session level variable during sync.
      a. On the Select statement, you need to do a parameterized query, such as STATE=@rowfilter, and also need to add parameter @rowfilter, nvarchar(32) to this statement.
      b. In the sync app, add a SyncParameter using the same name as the @rowfilter to SyncAgent.Configuration.SyncParameters.Add().


    Leo Zhou ------ This posting is provided "AS IS" with no warranties, and confers no rights.
    Wednesday, July 22, 2009 5:46 PM