Answered problem adding filter parameters

  • 2 marca 2011 20:29
     
     

    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!

     

Wszystkie odpowiedzi

  • 11 marca 2011 18:40
    Moderator
     
     Odpowiedz

    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