That would work but breaks the abstraction. Presumably this is part of his 
IRepository<T>.

We have the same abstraction and instead of putting lambdas straight onto the 
repository.Entities, we instead use the Specification<T> pattern.

Even still we would still have the same problem.

 

From: [email protected] 
[mailto:[email protected]] On Behalf Of Jordan Knight
Sent: Monday, 6 September 2010 7:13 PM
To: ozSilverlight
Subject: Re: Ria Services : Where clause with multiple items

 

Pass the params up to the server and process it there... (just add a param to 
your query method)

Cheers,

 

Jordan. 


On 06/09/2010, at 4:15 PM, David Burela <[email protected]> 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
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight

_______________________________________________
ozsilverlight mailing list
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight

Reply via email to