Lambda expressions are serialisable with the right serialiser. you could
have a custom service method that takes a string as input which happens to
be the serialised lambda.

Deserialise it and apply the lambda to your entity model and then return the
results.

 

Have no idea if this would actually work though J

 

From: ozsilverlight-boun...@ozsilverlight.com
[mailto:ozsilverlight-boun...@ozsilverlight.com] On Behalf Of David Burela
Sent: Monday, 6 September 2010 5:10 PM
To: ozSilverlight
Subject: Re: Ria Services : Where clause with multiple items

 

This sounded like the perfect solution.

But unfortunately RIA crashes

"Nested query expressions are not supported"

 

-David Burela

On 6 September 2010 16:41, Peter Gfader <pe...@gfader.com> wrote:

Hi David

 

Check out  the PredicateBuilder from J. Albahiri ("Nesting Predicates")

 

Source here

http://www.albahari.com/nutshell/predicatebuilder.aspx

 

.peter.gfader.

http://blog.gfader.com/

http://twitter.com/peitor

 

On Mon, Sep 6, 2010 at 4:15 PM, David Burela <david.bur...@gmail.com> wrote:

This seems like a simple problem but I am stumped.

 

I have a screen with a number of filters. In one instance I have checkboxes
of countries (Australia, China, Japan, etc).

I want to filter to only show products that are located in the checked
countries. So products listed in Australia OR in China OR in Japan.

 

My issue is that the RIA servies query object, only lets you chain up ANDs

var query = ProductDomainContext.ProductSelectQuery();
if(AustraliaIsSelected)
    query = query.Where(p => p.Country == "Australia");
if(ChinaIsSelected)
    query = query.Where(p => p.Country == "China");

Doing it this way will end up with a query where the country is Australia
AND China.

I was hoping I could go

 
var checkedCountries = new []{"Australia", "China"};
query = query.Where(p => checkedCountries.Contains(p.Country)

But RIA complains that it does not support the contains operation.

Any ideas?

 

-David Burela

 

 

 

P.S.

I can't do it on one line like this

query.Where(p => p.Country=="Australia" || p.Country == "China");

Because at runtime I don't know how many are there. The above is just a
simplified example

 

_______________________________________________
ozsilverlight mailing list
ozsilverlight@ozsilverlight.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight




-- 

 

.peter.gfader.

http://blog.gfader.com/

http://twitter.com/peitor

 

 


_______________________________________________
ozsilverlight mailing list
ozsilverlight@ozsilverlight.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight

 

_______________________________________________
ozsilverlight mailing list
ozsilverlight@ozsilverlight.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight

Reply via email to