That seems like a reasonable suggestion.

 

I had considered writing it as linq, but assumed it would have the same
problem.  I didn't realise you could check the rest URL,  thanks.

 

From: Asheesh Soni [mailto:[email protected]] 
Sent: Friday, 10 July 2009 1:47 PM
To: [email protected]
Subject: Re: ado.net data services query filtering

 

Why don't you simply write a linq query and let it do the translation
for you?
And if you are curious, you can set a break point and see what REST url
it is using to get the results.

Or have I missed something really obvious and made a fool of myself?

On Wed, Jul 8, 2009 at 2:59 PM, Ross Jempson
<[email protected]> wrote:

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]
<mailto:[email protected]> 
Subscribe: [email protected]
<mailto:[email protected]> 
Unsubscribe: [email protected]
<mailto:[email protected]> 
List FAQ: http://www.codify.com/lists/ozsilverlight
<http://www.codify.com/lists/ozsilverlight> 
Other lists you might want to join: http://www.codify.com/lists
<http://www.codify.com/lists>  

 

________________________________

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

--------------------------------------------------------------------------------
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