I would like to query data given an array to filter by via WCF Data Services using the Silverlight Client API. Basically, I want to query Employees given a list (array) of
You can dynamically build the expression tree for the condition.
var parameter = Expression.Parameter(typeof(Employee), "employee");
Expression condition = Expression.Constant(false);
foreach (var state in states)
{
condition = Expression.OrElse(
condition,
Expression.Equal(
Expression.Property(parameter, "State"),
Expression.Constant(state)));
}
var expression = Expression.Lambda>(condition, parameter);
And then just perform the call.
var result = Context.Employees.Where(expression);
I am not 100% sure if this will work out of the box for you but I hope the general idea helps.