有没有一种方式重新与OData的present摘要行? [英] Is there a way to represent summary rows with OData?

查看:151
本文介绍了有没有一种方式重新与OData的present摘要行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图钉在补充资料项目列表从 ODataController 的方法返回。用例是汇总行。所以,我们基本上要返回报告的行,然后还与合计其他信息,小计等。

I'm trying to tack on additional information to the list of items returned from an ODataController's method. The use case is summary rows. So we basically want to return the rows of the report and then also additional info with totals, sub-totals, etc.

所以,基本上开始用此方法:

So, basically starting with this method:

public PageResult<MyReportLine> Get(ODataQueryOptions odataQueryOptions)

我试过包装 MyReportLine MyReport

public class MyReport {
    IEnumerable<MyReportLine> _myReportLines;
    MySummaryRow _mySummaryRow;
}

,然后再返回这个 MyReport 对象。

public PageResult<MyReport> Get(ODataQueryOptions odataQueryOptions)

这个方法似乎乱了所有的查询机制,因为在URI中提供的查询是针对 MyReportLine ,但 MyReport 是的暴露实际的类。我不认为包装/总结应该是一流的实体...

This approach seemed to mess up all the querying mechanisms because the query supplied in the URI was targeting MyReportLine, but MyReport is the actual class that's exposed. I don't think that the wrapper/summary should be a first-class entity...

有没有推荐的方法把这个任务?

Is there a recommended approach to this task?

推荐答案

您应该使用ODataQueryOptions即

You should use ODataQueryOptions i.e

public PageResult<MyReport> Get(ODataQueryOptions<MyReportLine> odataQueryOptions)

这篇关于有没有一种方式重新与OData的present摘要行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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