Tuesday, April 1, 2014

OData: create a query using AddQueryOption

I got a question from a customer who wanted to create an ‘'IN” query(something like SELECT * FROM Address WHERE Postcode IN (2000, 1100, 1940, 1745)).

This is something you cannot do out-of-the-box using OData(not that I’m aware of). A possible alternative is using the AddQueryOption and build the filter condition yourself:

Remark: This only works if the list of elements is rather small.

1 comment:

Khalid Ashraf said...

What are the other operators available besides "eq", for e.g. not eq, like, any idea?

Thanks in advance