locked
problem adding filter parameters RRS feed

  • Question

  • Hi, I'm having problems adding filter parameters to the client context in a silverlight application. Here is how I am doing it:

     

                dc5DN.CacheController.ControllerBehavior.AddScopeParameters("companyID", "test");

                dc5DN.CacheController.ControllerBehavior.AddScopeParameters("sessionID", "test2");

                var test4 =dc5DN.CacheController.ControllerBehavior.ScopeParameters.Current.Key;

    when I break after the test4 variable is assigned, it is null. Why aren't the parameters being assigned? Also, the data that is returned from the sync service is not filtered (I've configured the filters on the server and in the sync config file). Is there a way to set it so that it won't return any data if the scope parameters aren't set? Thanks!

     

    Wednesday, March 2, 2011 8:29 PM

Answers

  • Hi sekhmeti,

    You can use a while loop to loop through the scope parameters collection. Something like the following:

     

     

    var enumerator = _context.CacheController.ControllerBehavior.ScopeParameters;
    while (enumerator.MoveNext())
    {
         string value = enumerator.Current.Value;
         Debug.WriteLine(value);
    }

    For the second part of your question, did you configure the database and the service with the filter parameters? i.e. Did the config file for SyncSvcUtil.exe contain the scope parameters and did you add the filter parameters using the config.AddFilterParameterConfiguration method in the .svc.cs file that was code generated?

     


    SDE, Sync Framework - http://www.giyer.com
    • Proposed as answer by Ganeshan Friday, March 11, 2011 6:40 PM
    • Marked as answer by Ganeshan Wednesday, March 30, 2011 11:31 PM
    Friday, March 11, 2011 6:40 PM