如何在WCF Restfull服务中将多个参数传递到WebInvoke中的UriTemplate? [英] How to pass multiple parameters into the UriTemplate in WebInvoke in WCF Restfull service?

查看:510
本文介绍了如何在WCF Restfull服务中将多个参数传递到WebInvoke中的UriTemplate?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将多个参数传递到WCF Restfull服务中的WebInvoke中的UriTemplate?

即在我的界面中我使用了两个参数..



例如:



界面:



How to pass multiple parameters into the UriTemplate in WebInvoke in WCF Restfull service?

i.e in my interface i used two parameters..

Eg:

Interface:

[WebInvoke(uriTemplate="")
public bool FilterItem(sting ItemId, string ItemName)
{
   
}

Class:
public bool FilterItem(sting ItemId, string ItemName)
{
  // Coding Part   
}

推荐答案

试试这个



[WebGet(UriTemplate =?id = {ItemId}&name = {ItemName})]

public bool FilterI tem(sting ItemId,string ItemName)

{

//编码

}
Try This

[WebGet(UriTemplate = "?id={ItemId}&name={ItemName}")]
public bool FilterItem(sting ItemId, string ItemName)
{
//Coding
}


这篇关于如何在WCF Restfull服务中将多个参数传递到WebInvoke中的UriTemplate?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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