Aggregate Queries oData (Simple.oData)

2.3k Views Asked by At

I am trying to issue aggregate queries to my oData server, but i get errors, dispute having the exact same code as in documentation

var product = await client
            .For("People")
            .Filter("FirstName ne 'Joni'")
            .Count()
            .FindScalarAsync();

Code in documentation

var x = ODataFilter.Expression;
        var count = await _client
            .For("Products")
            .Filter("ProductName+eq+%27Chai%27")
            .Count()
            .FindScalarAsync();
        Assert.Equal(1, count);

From: https://github.com/object/Simple.OData.Client/wiki/Retrieving-data-matching-search-criteria

In this same case, why are they declaring "x"? It is never used.

Also, how would i go about accessing functions like Min/Max that are defined here:

http://docs.oasis-open.org/odata/odata-data-aggregation-ext/v4.0/cs01/odata-data-aggregation-ext-v4.0-cs01.pdf

2

There are 2 best solutions below

0
On

I developed the AdaptiveLINQ component which introduces the concept of cube in a LINQ query (on any LINQ provider supporting GroupBy).

This allows to perform a server-side aggregation simply by specifying a $select query.

Example:

SalesView?$select=CustomerName,Sales

assuming SalesView is defined by a cube with the dimension CustomerName and the measure Sales.

0
On

Never mind, Aggregate queries are not supported yet

Source: https://github.com/object/Simple.OData.Client/issues/76