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

Reply via email to