Note that there are some explanatory texts on larger screens.

plurals
  1. POWeb API OData Inlinecount not working
    primarykey
    data
    text
    <p>I am using the out of the box ValuesController in a ASP.NET Web API application</p> <pre><code> public class ValuesController : ApiController { // GET api/values [Queryable(PageSize = 1)] public IQueryable&lt;string&gt; Get() { return new string[] { "value1", "value2", "value3", "value4", "value5" }.AsQueryable(); } } </code></pre> <p>When I <code>get http://localhost/api/values?$inlinecount=allpages</code> </p> <p>This is the response </p> <pre><code>&lt;ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt; &lt;string&gt;value1&lt;/string&gt; &lt;/ArrayOfString&gt; </code></pre> <p>I have uncommented <code>config.EnableQuerySupport();</code></p> <p>Filtering, sorting work fine. </p> <p>If I try <code>get http://localhost/api/values?$inlinecount=XXXXX</code> I get an exception, so it seems the Web API application knows about <code>inlinecount</code></p> <pre><code>&lt;Message&gt;The query specified in the URI is not valid.&lt;/Message&gt; &lt;ExceptionMessage&gt;'xxx' is not a valid value for $inlinecount.&lt;/ExceptionMessage&gt; &lt;ExceptionType&gt;Microsoft.Data.OData.ODataException&lt;/ExceptionType&gt; </code></pre> <p>I definitely have the Microsoft.AspNet.WebApi.OData package - here is the output of the Package Manager Console </p> <pre><code>PM&gt; Install-Package Microsoft.AspNet.WebApi.OData Attempting to resolve dependency 'Microsoft.Net.Http (= 2.0.20710.0 &amp;&amp; &lt; 2.1)'. Attempting to resolve dependency 'Microsoft.AspNet.WebApi.Client (= 4.0.20710.0 &amp;&amp; &lt; 4.1)'. Attempting to resolve dependency 'Newtonsoft.Json (= 4.5.6)'. Attempting to resolve dependency 'Microsoft.AspNet.WebApi.Core (= 4.0.20710.0 &amp;&amp; &lt; 4.1)'. Attempting to resolve dependency 'Microsoft.Data.OData (= 5.2.0 &amp;&amp; &lt; 5.3.0)'. Attempting to resolve dependency 'System.Spatial (= 5.2.0)'. Attempting to resolve dependency 'Microsoft.Data.Edm (= 5.2.0)'. 'Microsoft.AspNet.WebApi.OData 4.0.0' already installed. WebServicesProject already has a reference to 'Microsoft.AspNet.WebApi.OData 4.0.0'. </code></pre> <p>Any suggestions?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload