本文介绍了REST WCF服务-使用QueryString参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有此REST WCF服务.
I have this REST WCF service.
[WebInvoke(UriTemplate = "/GetNames/{Category}?order=asc", Method = "POST", ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]
public List<Names> GetNames(string Category)
{
//Code to retrieve Names by category.
}
Category参数映射到Uri中的{Category}
.
The Category parameter is mapped to {Category}
in the Uri.
但是如何将Uri中的订单查询字符串映射到此方法?
But how can I map the order query string in the Uri to this method?
将订单添加为参数方法无效.
Adding the order as a parameter method is not working.
请帮助.预先感谢.
推荐答案
您是否尝试过-Uritemplate和函数
Have you tried - "/GetNames/{Category}?order={ordering}" in the Uritemplate and in the function
public List<Names> GetNames(string Category, string ordering)
{
//Code to retrieve Names by category.
}
这篇关于REST WCF服务-使用QueryString参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!