ODataSamples icon indicating copy to clipboard operation
ODataSamples copied to clipboard

How can I return the total count with the EdmEntityObjectCollection for paging?

Open rogerskk opened this issue 6 years ago • 0 comments

I'm using the DynamicEdmModelCreation sample and I've generated my EdmModel from a database query because what I'm working on has to support multiple client databases and some have custom fields so not every table will be the same.

I want to be able to do paging and have manually added the top and skip to my query getting the query options as follows: var model = EdmModelHelper.EdmModel; IEdmEntityType entityType = model.SchemaElements.OfType<IEdmEntityType>().First(c => c.Name == "Products");

        ODataQueryContext queryContext = new ODataQueryContext(model, entityType, path);
        ODataQueryOptions queryOptions = new ODataQueryOptions(queryContext, Request);

queryOptions.Count is read only. I'm not seeing how I can return the total count, even if I add $count=true in the url.

rogerskk avatar Feb 22 '20 01:02 rogerskk