Reputation: 1377
I have two enities in my wcf-data-service:
Request
and Server
one Request can be assigned to multiple servers, whereas on server can have multiple requests.
I want to query all requests that are assigned to a specific number of servers (in this example: all requests that are assigned to the servers with ID=1 and ID=2) like:
http://localhost/MyDataService/Request?$filter=(Server.ID eq 1 and Server.ID eq 2)
However this does of course not work. Is this possible with odata? If not: Is there a workaround?
Upvotes: 0
Views: 525
Reputation: 13320
With the RTM bits this is not possible. But in OData V3 we're adding any/all operators which should allow this. Something like this should work:
/Requests?$filter=Servers/any(s: s/ID eq 1) and Servers/any(s: s/ID eq 2)
You can try this with the latest CTP: http://blogs.msdn.com/b/astoriateam/archive/2011/10/13/announcing-wcf-data-services-oct-2011-ctp-for-net-4-and-silverlight-4.aspx
If you need to remain on V2 you can write a service operation to perform this operation for you.
Upvotes: 2