5

I'm trying the following code..

LoadOperation<Tasks> PhasesLP = context.
    Load(context.GetTasksQuery().
    Where(o=> ProjectList.Where(p=> p.ProjectID == o.ProjectID).Count() == 1)  

I get the following error:

Query operator 'Count' is not supported.

I want to basically be able to specify a Where In clause instead of Where =.

Anyone has an idea of how I can achieve this?

Drew Noakes
  • 300,895
  • 165
  • 679
  • 742
user1106741
  • 237
  • 2
  • 5
  • 11

1 Answers1

2

Have you tried:

.SingleOrDefault() != null

I'm not familiar with RIA, but sometimes these kinds of alternate equivalent expressions work with EF.

Also, with EF, it's possible to do a SQL-style WHERE IN (...) using .Any(...).

Off the top of my head, this kind of thing works:

entities.Where(e => ids.Any(i => e.Id == i))

ids may be a list of IDs, another list of entities or a subquery, IIRC.

Drew Noakes
  • 300,895
  • 165
  • 679
  • 742