的OData的WebAPI包括不使用$扩展选项相关的实体 [英] WebAPI OData include related entities without using $expand option

查看:113
本文介绍了的OData的WebAPI包括不使用$扩展选项相关的实体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在扩展<一个href=\"http://stackoverflow.com/questions/22071839/include-related-entities-with-webapi-odata-request\">this较早前的问题

从文档<一个href=\"http://www.asp.net/web-api/overview/odata-support-in-aspnet-web-api/using-%24select,-%24expand,-and-%24value\"相对=nofollow>这里,它指出:

当你查询的OData的实体或集合,默认响应不包括相关的实体。

"When you query an OData entity or collection, the default response does not include related entities."

有什么办法,包括相关实体的没有使用$ expand选项?

Is there any way to include related entities without using the $expand option?

推荐答案

没有,没有办法遏制相关的实体,而无需使用$扩展。但是,如果你只希望相关的那些,你可以使用导航属性,如:
〜/分类(1)/产品

No, there is no way to contain the related entities without using the $expand. But if you only want the related ones, you can use navigation property such as: ~/Categories(1)/Products

这篇关于的OData的WebAPI包括不使用$扩展选项相关的实体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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