How to use "SelectMany" with DataServiceQuery<>
- by sako73
I have the following DataServiceQuery running agaist an ADO Data Service (with the update installed to make it run like .net 4):
DataServiceQuery<Account> q = (_gsc.Users
.Where(c => c.UserId == myId)
.SelectMany(c => c.ConsumerXref)
.Select(x => x.Account)
.Where(a => a.AccountName == "My Account" && a.IsActive)
.Select(a => a)) as DataServiceQuery<Account>;
When I run it, I get an exception: Cannot specify query options (orderby, where, take, skip) on single resource
As far as I can tell, I need to use a version of "SelectMany" that includes an additonal lambda expression (http://msdn.microsoft.com/en-us/library/bb549040.aspx), but I am not able to get this to work correctly.
Could someone show me how to properly structure the "SelectMany" call?
Thank you for any help.