OData selection query does not work in ASP.NET WebAPI beta

I am playing with the beta version of WebAPI and it seems that selects do not affect the response of the action returning IQueryable. For instance:

HTTP: // local: 62689 / API / product $ select = Id, Name

Expected:

<Product> <Id>1</Id> <Name>Product 1</Name> </Product> 

Actual result:

 <Product> <Id>1</Id> <Name>Product 1</Name> <ItemsInStock>6</ItemsInStock> <Price>49.99</Price> <Created>2012-01-15T00:00:00</Created> </Product> 

Are there restrictions on OData support for WebAPI?

I tried other queries on this dataset (e.g. top, filter) and they work great.

+6
source share
1 answer

The web API does not support OData $ select query.

Current support for query string parameters is limited to $ top, $ skip, $ filter, and $ orderby.

Take a look at this forum for more details.

+5
source

Source: https://habr.com/ru/post/909724/


All Articles