简体   繁体   English

WCF中的重定向方法调用

[英]Redirect method call in wcf

How to redirect a wcf method call to another method in wcf. 如何将wcf方法调用重定向到wcf中的另一个方法。

lets say a user call wcf method GetDetail(para1,para2) and we redirect it to GetMyDetail(para1, para2) . 假设用户调用wcf方法GetDetail(para1,para2)然后将其重定向到GetMyDetail(para1, para2)

So basically for user its GetDetail method, but in wcf side instead of Getdetail method we will call GetMyDetail method and send result back to user. 因此,基本上是为用户提供其GetDetail方法,但是在wcf端而不是 Getdetail方法中,我们将调用GetMyDetail方法并将结果发送回用户。

on google i found some article saying that this can be achieve using IClientOperationSelector but was not able to found any example. 在google上,我发现有一篇文章说可以使用IClientOperationSelector来实现,但找不到任何示例。

This is not for single method, a mapping will be written in webconfig/xml file for call forwarding method and parameters. 这不适用于单一方法,将在webconfig / xml文件中写入映射以用于呼叫转移方法和参数。

You can call this way 你可以这样叫

public int GetDetail(para1,para2)
{

   return GetMyDetail(para1, para2...)
}

or user function overloading 或用户功能重载

[OperationContract(Name="GetDetail")]
string GetMyDetail(int para1,int para2);
//Initail method
[OperationContract(Name = "GetDetail")]
string GetDetail(string para1, string para2);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM