[英]ASP.net MVC oData route with parameters
Is it possible to use addresses like that : 是否可以使用这样的地址:
http://community.innovacall.local/odata/contactcompetencies(id=GetById/4a50412c-4e36-468a-b7d1-a36a78f02b02)?%24inlinecount=allpages&%24top=10 http://community.innovacall.local/odata/contactcompetencies(id = GetById / 4a50412c-4e36-468a-b7d1-a36a78f02b02)?%24inlinecount = allpages&%24top = 10
I handmade a workaround for the second one but I'm sure there is a out of the box solution. 我为第二个手工制作了一种解决方法,但是我确定有一个现成的解决方案。
Guid userId = Guid.Parse(Request.Properties["MS_ODataPath"].ToString().Split('(')[1].Split(')')[0].Split('=')[1]);
Could you help me to find it ? 你能帮我找到它吗?
Use &
to separate query string options 使用
&
分隔查询字符串选项
Use $filter
to filter the data (see here ): 使用
$filter
过滤数据(请参阅此处 ):
community.innovacall.local/odata/contactcompetencies?$filter=id eq 1
community.innovacall.local / odata / contactcompetencies?$ filter = id eq 1
Use guid'<value>'
for guids (see here ) 将
guid'<value>'
用于guid(请参见此处 )
community.innovacall.local/odata/contactcompetencies?$filter=id eq guid'4a50412c-4e36-468a-b7d1-a36a78f02b02'
community.innovacall.local / odata / contactcompetencies?$ filter = id eq guid'4a50412c-4e36-468a-b7d1-a36a78f02b02'
Use $inlinecount=allpages
to get a count of records (see here ) 使用
$inlinecount=allpages
获取记录数(请参阅此处 )
community.innovacall.local/odata/contactcompetencies?$filter=id eq guid'4a50412c-4e36-468a-b7d1-a36a78f02b02'&$inlinecount=allpages
community.innovacall.local / odata / contactcompetencies?$ filter = id eq guid'4a50412c-4e36-468a-b7d1-a36a78f02b02'&$ inlinecount = allpages
Use $top
and $skip
to page through the results (see here and here ) 使用
$top
和$skip
翻页结果(请参见此处和此处 )
community.innovacall.local/odata/contactcompetencies?$filter=id eq guid'4a50412c-4e36-468a-b7d1-a36a78f02b02'&$inlinecount=allpages&$top=10&$skip=10
community.innovacall.local / odata / contactcompetencies?$ filter = id eq guid'4a50412c-4e36-468a-b7d1-a36a78f02b02'&$ inlinecount = allpages&$ top = 10&$ skip = 10
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.