Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF RIA - Query operator 'Count' is not supported

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?

like image 844
user1106741 Avatar asked Nov 04 '22 08:11

user1106741


1 Answers

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.

like image 167
Drew Noakes Avatar answered Nov 15 '22 00:11

Drew Noakes