是否Asp.net的Web API 2.2 OData4支持group by子句? [英] Does Asp.net Web API 2.2 OData4 support group by clause?

查看:398
本文介绍了是否Asp.net的Web API 2.2 OData4支持group by子句?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请问Asp.net的Web API 2.2 OData4支持总量和GROUPBY条款?
我找不到任何确凿的答案。

Does Asp.net Web API 2.2 OData4 support aggregates and groupby clause? I could not find any conclusive answer to this .

推荐答案

另一种方法是使用由在 QueryByCube LINQ扩展方法来实现您的服务= http://www.adaptivelinq.com相对=nofollow> AdaptiveLINQ 组成部分。

An alternative is to implement your service using the QueryByCube linq extension method provided by the AdaptiveLINQ component.

例如:

[EnableQuery]
public IQueryable<SalesCubeItem> Get()
{
     return DataContext.OrderDetails.QueryByCube(new SalesCubeDefinition());
}

其中, SalesCubeDefinition 定义:


  • 2的尺寸:产品名称客户名称

  • 2的措施:销售数量

  • 2 dimensions: ProductName and CustomerName
  • 2 measures: Sales, Quantity

您可以查询的每个客户的销售的使用OData的协议是这样的:

you can query the sales per customer using the OData protocol like this:

http://.../salesAnalysis?$select=CustomerName,Sales

量按产品销售的的:

http://.../salesAnalysis?$select=ProductName,Quantity

当然你可以与其他运营商的OData($过滤器,$排序依据......)相结合这一

and of course you can combine this with other OData operators ($filter, $orderby...)

免责声明:我是AdaptiveLINQ开发商

Disclaimer: I'm the AdaptiveLINQ developer

这篇关于是否Asp.net的Web API 2.2 OData4支持group by子句?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆