Hi there,
I tried implementing the code required to enable $inlinecount=allpages to return me the extra metadata in my Web API response required for server side paging including Count and NextPageLink today, however I was consistently only receiving my original data as List<T>, not PageResult<T>, so all I was receiving was an array of my original data.
After further investigation and taking a copy and paste of the PageResult<T> and PageResult classes, renaming them and breaking them down, I then discovered the implementation call to IEnumerable<T>which is declared on the original PageResult<T> class signature was causing the failure and the loss of the extra metadata. Once I removed the line to implement this interface, and the associated IEnumerable.GetEnumerator() functions everything worked, I received my Items = [], Count = X, NextPageLink = ".." perfectly as described in the blog as what I should receive.
It appears the reason I believe as to why I am receiving this failure when switching those lines is because I'm using the ServiceStack.Text JSON library as a custom formatter in my Global.asax via this line:
```
GlobalConfiguration.Configuration.Formatters.Insert(0, new ServiceStackTextFormatter());
```
I had chosen to use this JSON formatter as a few months ago it appeared quicker than the NewtonSoft one. As soon as I remove that line, the API call works correctly again. Is this an issue within ServiceStack, or the fact other JSON formatters were not considered with the OData development on the Web API?
If this is a bug I have discovered, happy to help with any other information you need.
Comments: Looks like the ServiceStackTextFormatter does not implement DataContract and DataMemeber hence returns the data as an IEnumerable instead of populating NextPageLink and Count.
I tried implementing the code required to enable $inlinecount=allpages to return me the extra metadata in my Web API response required for server side paging including Count and NextPageLink today, however I was consistently only receiving my original data as List<T>, not PageResult<T>, so all I was receiving was an array of my original data.
After further investigation and taking a copy and paste of the PageResult<T> and PageResult classes, renaming them and breaking them down, I then discovered the implementation call to IEnumerable<T>which is declared on the original PageResult<T> class signature was causing the failure and the loss of the extra metadata. Once I removed the line to implement this interface, and the associated IEnumerable.GetEnumerator() functions everything worked, I received my Items = [], Count = X, NextPageLink = ".." perfectly as described in the blog as what I should receive.
It appears the reason I believe as to why I am receiving this failure when switching those lines is because I'm using the ServiceStack.Text JSON library as a custom formatter in my Global.asax via this line:
```
GlobalConfiguration.Configuration.Formatters.Insert(0, new ServiceStackTextFormatter());
```
I had chosen to use this JSON formatter as a few months ago it appeared quicker than the NewtonSoft one. As soon as I remove that line, the API call works correctly again. Is this an issue within ServiceStack, or the fact other JSON formatters were not considered with the OData development on the Web API?
If this is a bug I have discovered, happy to help with any other information you need.
Comments: Looks like the ServiceStackTextFormatter does not implement DataContract and DataMemeber hence returns the data as an IEnumerable instead of populating NextPageLink and Count.