Hi there,

 

This might be slightly off topic, but I'll try my luck.


I am trying to figure out whether I can filter on child collections of
an ado.net data services query in a Silverlight app.

 

For example, the following examples work nicely, and are good for
performance as I don't need round trips to the server when populating
child entity collections:

 

 

this.DataContext.BeginExecute<Screen>(new
Uri("Screen?$expand=ScreenMenuItem/ScreenMenuItemCountry,ScreenBackgroun
dImage,ScreenVideoSubstituteImage,ScreenCountryText,ScreenCountryVideo",

                                                UriKind.Relative),

               ScreenLookupDataCallback, this.DataContext);

 

 

this.DataContext.BeginExecute<MainMenuItemCountry>(new
Uri(string.Format("MainMenuItemCountry?$expand=MainMenuItem/Screen&$filt
er=CountryId eq {0}", _loc.ApplicationSettings.CountryId),

                                                UriKind.Relative),

               MainMenuItemsDataCallback, this.DataContext);

 

 

Notice in the second query I am filtering the 'MainMenuItemCountry' by
CountryId.  Note how this filter is against the top level entity.

 

I would like to do the same thing in the first query, but I want to
filter by country for the ScreenMenuItem/ScreenMenuItemCountry entities.
Eg something like

 

 

this.DataContext.BeginExecute<Screen>(new
Uri("Screen?$expand=ScreenMenuItem/ScreenMenuItemCountry,ScreenBackgroun
dImage,ScreenVideoSubstituteImage,ScreenCountryText,ScreenCountryVideo&$
filter= ScreenMenuItem/ScreenMenuItemCountry/CountryId eq 61 ",

                                                UriKind.Relative),

               ScreenLookupDataCallback, this.DataContext);

 

However, this results in a bad request.  The following link implies it
is not possible to filter the 'expanded' child collection, but I can't
be sure.  http://msdn.microsoft.com/en-us/library/cc668778.aspx

 

Has anyone tried this?

Cheers.

Ross

--------------------------------------------------------------------------------
Support procedure: https://www.codify.com/lists/support
List address: [email protected]
Subscribe: [email protected]
Unsubscribe: [email protected]
List FAQ: http://www.codify.com/lists/ozsilverlight
Other lists you might want to join: http://www.codify.com/lists

Reply via email to